What is the best way (or are the various ways) to pretty print XML in Python?
You can use popular external library xmltodict, with unparse and pretty=True you will get best result:
unparse
pretty=True
xmltodict.unparse( xmltodict.parse(my_xml), full_document=False, pretty=True)
full_document=False against at the top.
full_document=False