ElementTree and proper identation?

Sébastien Boisgérault Sebastien.Boisgerault at gmail.com
Wed Sep 27 14:12:21 EDT 2006


John Salerno a écrit :

> I've been doing a little studying of ElementTree and it doesn't seem
> very satisfactory for writing XML files that are properly
> formatted/indented. I saw on the website that there is an
> indent/prettyprint function, but this isn't listed in the Python docs
> and I didn't see it after doing a dir(), so I guess it isn't a part of
> the Python version.

It *may* be included in a *future* release of ElementTree. For now, why
don't
you simply drop the 12 lines of codes of the prettyprint function into
your
project ? Source available at http://effbot.org/zone/element-lib.htm

Cheers,

SB




More information about the Python-list mailing list