reading files into dicts

Tim Williams (gmail) tdwdotnet at gmail.com
Thu Dec 29 19:29:24 EST 2005


On 30/12/05, rbt <rbt at athop1.ath.vt.edu> 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: <http://mail.python.org/pipermail/python-list/attachments/20051230/027db4dc/attachment.html>


More information about the Python-list mailing list