title: Python lxml finding element by id-tag
body: <p>I am working on a python program for keeping an inventory of a storage room. In a XML-document the amount of toners will be kept and I want my python program to be able to add, remove and display the amount of toners for different printers and different colors.</p>
  
  <p>My XML looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;printer&gt;
      &lt;t id="095205615111"&gt; &lt;!-- 7545 Magenta --&gt;
          &lt;toner&gt;7545 Magenta Toner&lt;/toner&gt;
          &lt;amount&gt;3&lt;/amount&gt;
      &lt;/t&gt;
      &lt;t id="095205615104"&gt; &lt;!-- 7545 Yellow --&gt;
          &lt;toner&gt;7545 Yellow Toner&lt;/toner&gt;
          &lt;amount&gt;7&lt;/amount&gt;
      &lt;/t&gt;
  &lt;/printer&gt;
  </code></pre>
  
  <p>The id is the number from the barcode that we use for inventory.</p>
  
  <p>So far I have these steps that I would like my program to use:</p>
  
  <ol>
  <li><p>Check if the id exist (the id-value is a variable in my python program piped from the content in a txt-file)</p></li>
  <li><p>Change the value of amount in the xml-document to +1 or -1</p></li>
  </ol>
  
  <p>Whatever I try it never works fully. Do you have any suggestions of what I could use?</p>