En Sun, 14 Sep 2008 15:09:52 -0300, Aaron "Castironpi" Brady <[EMAIL PROTECTED]> escribió:

On Sep 14, 10:28 am, nielinjie <[EMAIL PROTECTED]> wrote:
Hi list:
I just want to marshal objects (instance of custom classes)to a human
*READABEL *file/string, and also, I want unmarshal it back. in xml
format or any other format.
Any advice? Which lib should I use?

The PyYAML package produces the following (continued):

print yaml.dump( a )
&id001 !!python/object:__main__.A
b: 0
c: abc
d: !!python/object:__main__.A
  d: efg
  e: 1.2
  parent: *id001


JSON is another format, much simpler and probably more suited for human reading. But it is somewhat limited on what it can represent. There are a few Python implementations, maybe the most used is simplejson, which comes bundled with Python 2.6 as the json module.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to