ElementTree write creates large one line XML file ....

robert somerville rbrt.somerville at gmail.com
Fri May 28 12:55:46 EDT 2010


Thanks Robert Kern :

"prettyprint" ; indent()  does the trick ;-)


>ElementTree writes exactly what you tell it to. In XML, whitespace is
>significant. If you want newlines and/or indentation to make it pretty-looking,
>then you need to add those to your elements.
>
>Fredrik provides an example function for doing this:
>
>   http://effbot.org/zone/element-lib.htm#prettyprint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100528/e4f023d8/attachment.html>


More information about the Python-list mailing list