Skip to content

Instantly share code, notes, and snippets.

@davidfmiller
Created January 30, 2019 20:35
Show Gist options
  • Save davidfmiller/d726b6798f71afbb3b836c9ec9283006 to your computer and use it in GitHub Desktop.
Save davidfmiller/d726b6798f71afbb3b836c9ec9283006 to your computer and use it in GitHub Desktop.
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