Convert Python ElementTree to string
Element objects have no .getroot() method. Drop that call, and the .tostring() call works: xmlstr = ElementTree.tostring(et, encoding=’utf8′, method=’xml’) You only need to use .getroot() if you have an ElementTree instance. Other notes: This produces a bytestring, which in Python 3 is the bytes type. If you must have a str object, you have two … Read more