Using file objects with elementtree

castironpi at gmail.com castironpi at gmail.com
Wed May 14 18:34:17 EDT 2008


On May 14, 3:09 pm, dj <d.a.aberna... at gmail.com> wrote:
> Hello,
>
> Rather then holding my XML document in memory before writing it to
> disk, I want to create a file object that elementtree will write each
> element to has it is created. Does any one know how to do that ?
>
> Here is my code so, far:
>
> fd = open("page.xml", "w")
> tree.write( fd, encoding="iso-8859-1")
>
> I know there's something I am doing wrong, but I just do not know
> what.

Sure.  Relational databases are more widely useful.  They're the
binary hold-on-disk for you-- a big XML file.



More information about the Python-list mailing list