title: How to replace the node value in xml and save the output in same xml using python
body: <p>I used minidom function to change the nodeValue in xml. But my code only changes the node value in buffer (when i print the xml , i get it with new value), i want to save the new node value to the original file. how is it possible? Pls help!</p>
  
  <p>This is my minidom code:</p>
  
  <pre><code>import xml.dom.minidom
  doc = xml.dom.minidom.parse('test.xml')
  nodelist = doc.getElementsByTagName("abc")[0].getElementsByTagName("mythread")
  for key in range(len(nodelist)):
      if key == 2:
          nodelist[key].firstChild.nodeValue = 111
  </code></pre>
  
  <p>Here is my xml:</p>
  
  <pre><code> &lt;abc&gt;
   &lt;mythread name="newthread"&gt;99&lt;/mythread&gt;
   &lt;mythread name="ramptime"&gt;16&lt;/mythread&gt;
   &lt;/abc&gt;
  </code></pre>
  
  <p>I need to change/replace newthread value from 99 to 111 &amp; save the value in the original file where it is located.</p>