save a dictionary in a file

Eric Davis endavis at
Mon Nov 15 19:30:18 CET 2004

Luis P. Mendes wrote:
> Hi,
> my program builds a dictionary that I would like to save in a file.
> My question is what are the simple ways to do it?
> The first solution I've thought of is to transform the dictionary in a
> list, with the key being the first element on that list, and the value
> as the second.  Then I could use pickle to do the write and read
> operations.  It seems simple and easy.
> Is there a more commonly used form to do it, yet in a simple way?
> Luis

Look at the pickle or ConfigParser modules.
Both of these will do what you are looking for in different ways.


More information about the Python-list mailing list