To pretty print an XML file in Python, you can use either the minidom or ElementTree module.
Using minidom:
main.py189 chars6 lines
Using ElementTree:
main.py208 chars6 lines
Both approaches generate a pretty XML string with indentation and line breaks for easy readability.
gistlibby LogSnag