Thursday, March 24, 2005

pretty-printing xml with python

It's pretty easy to do: import xml.dom.minidom inf = file('infile.xml') parser = xml.dom.minidom.parse(inf) inf.close() outf = file('outfile.xml', 'w') outf.write(parser.toprettyxml(indent=' ', newl='')) outf.close()

1 comment:

Anonymous said...

thanks. really helped.