2005/9/28, Christopher Arndt <[EMAIL PROTECTED]>:
[cut]
>
> See http://www.python.org/doc/current/lib/module-xml.dom.minidom.html for more
> info.
Hi, this seems to be exactly what I was looking for!
import sys
from xml.dom import minidom
INDENT = ' ' * 4
file = sys.argv[1]
content = open(file).read()
pretty = minidom.parseString(content).toprettyxml(indent=INDENT).encode('utf-8')
beautiful = open('%s.pretty' % file, 'w')
beautiful.write(pretty)
beautiful.close()
I looked at BeautifulSoup, as Adam suggested. However it seems very
powerful and probably *too* powerful for my actual simple needings.
Anyway I will remember for the future.
> HTH, Chris
Thanks both of you!
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor