how to create data to dump into yaml file

Chris Rebert clp2 at rebertia.com
Mon Feb 2 05:01:45 EST 2009


On Sun, Feb 1, 2009 at 11:41 PM,  <sibteym at infotechsw.com> wrote:
> hi
>    I have to create a yaml file using my list of objects.shall i need to
> create a string using my objects and then load and dump that string or
> is there any other way to create the yaml file.
>
> i want a yaml file to be created from [Text, Author,......]in this format
> Text:
>    - value1
>    - value2
>    - value 3
> Author:
>     name: bookName

The PyYAML library is available on http://pyyaml.org/
Also, since JSON is essentially a subset of YAML, you could use the
`json` module (http://docs.python.org/library/json.html) in the Python
std lib, albeit with differently formatted results.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list