John Salerno wrote: > John Salerno wrote: >> 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?
The indent() function modifies the elements themselves to add the indentation. So dump the tree to a string. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list