title: How to update/modify an XML file in python?
body: <p>I have an XML document that I would like to update after it already contains data.</p>
  <p>I thought about opening the XML file in <code>&quot;a&quot;</code> (append) mode. The problem is that the new data will be written after the root closing tag.</p>
  <p>How can I delete the last line of a file, then start writing data from that point, and then close the root tag?</p>
  <p>Of course I could read the whole file and do some string manipulations, but I don't think that's the best idea..</p>