Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
XML Pretty Print
#!/usr/bin/python
import xml.dom.minidom
import sys
input = sys.stdin.read()
dom = xml.dom.minidom.parseString(input)
pretty_xml_as_string = dom.toprettyxml(indent=' ', newl='\n')
print(pretty_xml_as_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.