xml config file to python object
Thomas Guettler
pan-newsreader at thomas-guettler.de
Tue Mar 26 16:42:55 EST 2002
Hi!
What is the easiest way to parse a xml config file to a
python object.
I would like to parse
<myconfig>
<foo>2</foo>
<bar>sun</bar>
<bar>moon</bar>
</myconfig>
to this:
obj={'myconfig': [
{ 'foo' : '2' }
{ 'bar' : ['sun', 'moon']}
]
}
I did it this weekend with a sax parser.
Is there a way to pickle (serialize) any python object
to xml and back?
After using the sax parser I asked myself why not use
a python file for the configuration? It is much easier.
thomas
More information about the Python-list
mailing list