ElementTree and proper identation?

John Salerno johnjsal at NOSPAMgmail.com
Wed Sep 27 14:34:05 EDT 2006


John Salerno wrote:
> Fredrik Lundh wrote:
>> John Salerno wrote:
>>
>>> Well, further research reveals that this function isn't available yet 
>>> in any version.
>>
>> what keeps you from using the source code on the page you're talking 
>> about ?
>>
>> </F>
>>
> 
> Yeah, actually I just gave this a try but I couldn't figure out where 
> the code needed to go or how to call the function. I tried creating an 
> Element with a few SubElements, then I did:
> 
> print >> filename, indent(root)
> 
> But that only wrote the value "None" into the file.

Ok, I see that indent() returns None. In that case, how do I get the 
formatted text that it produces?



More information about the Python-list mailing list