title: Updating XML elements and attribute values using Python etree
body: <p>I'm trying to use Python 2.7's <code>ElementTree</code> library to parse an XML file, then replace specific element attributes with test data, then save this as a unique XML file.</p>
  
  <p>My idea for a solution was to (1) source new data from a CSV file by reading a file to a string, (2) slice the string at certain delimiter marks, (3) append to a list, and then (4) use <code>ElementTree</code> to update/delete/replace the attribute with a specific value from the list.</p>
  
  <p>I've looked in the <code>ElementTree</code> documentation &amp; saw the <code>clear()</code> and <code>remove()</code> functions, but I have no idea of the syntax to use them adequately.</p>
  
  <p>An example of the XML to modify is below - attributes with <code>XXXXX</code> are to be replaced/updated:</p>
  
  <pre><code>&lt;TrdCaptRpt RptID="10000001" TransTyp="0"&gt;
      &lt;RptSide Side="1" Txt1="XXXXX"&gt;
          &lt;Pty ID="XXXXX" R="1"/&gt;
      &lt;/RptSide&gt;
  &lt;/TrdCaptRpt&gt;
  </code></pre>
  
  <p>The intended result will be, for example:</p>
  
  <pre><code>&lt;TrdCaptRpt RptID="10000001" TransTyp="0"&gt;
      &lt;RptSide Side="1" Txt1="12345"&gt;
          &lt;Pty ID="ABCDE" R="1"/&gt;
      &lt;/RptSide&gt;
  &lt;/TrdCaptRpt&gt;
  </code></pre>
  
  <p>How do I use the <code>etree</code> commands to change the base XML to update with an item from the list[]?</p>