What is the best way (or are the various ways) to pretty print XML in Python?
lxml is recent, updated, and includes a pretty print function
import lxml.etree as etree x = etree.parse("filename") print etree.tostring(x, pretty_print=True)
Check out the lxml tutorial: http://lxml.de/tutorial.html