Negroup - schrieb: > Hi all, I have an xml file where the tags are all on the same line, > without any newline. This file is quite big and difficult to read. I'd > like to format it in a convenient way, using indentation and nesting. > How to pretty print my content?
Untested: import sys from xml.dom import minidom file = sys.argv[1] doc = minidom.parse(file) print doc.toprettyxml(indent=2) See http://www.python.org/doc/current/lib/module-xml.dom.minidom.html for more info. HTH, Chris _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor