reading files into dicts

Tim Williams (gmail) tdwdotnet at
Fri Dec 30 01:29:24 CET 2005

On 30/12/05, rbt <rbt at> wrote:
> What's a good way to write a dictionary out to a file so that it can be
> easily read back into a dict later? I've used realines() to read text
> files into lists... how can I do the same thing with dicts? Here's some
> sample output that I'd like to write to file and then read back into a
> dict:

Depending on how often you need to read/write/access the dict,  either the
shelve module,  or the pickle / cpickle modules will do what you need.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list