Skip to content
Advertisement

Tag: marshalling

Convert Python ElementTree to string

Whenever I call ElementTree.tostring(e), I get the following error message: Is there any other way to convert an ElementTree object into an XML string? TraceBack: Answer Element objects have no .getroot() method. Drop that call, and the .tostring() call works: You only need to use .getroot() if you have an ElementTree instance. Other notes: This produces a bytestring, which in

Advertisement