2005/12/30, rbt <[EMAIL PROTECTED]>:
> 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:
>
> {'.\\sync_pics.py': 1135900993, '.\\file_history.txt': 1135900994,
> '.\\New Text Document.txt': 1135900552}
> --
> http://mail.python.org/mailman/listinfo/python-list
>

You can try the dict4ini module written by me.

http://wiki.woodpecker.org.cn/moin/Dict4Ini

The dict can be saved as an Ini file, and can be read back from the
Ini file.Just like:

 >>> import dict4ini
 >>> x = {'.\\sync_pics.py': 1135900993, '.\\file_history.txt':
1135900994, '.\\New Text Document.txt': 1135900552}
 >>> d = dict4ini.DictIni(values=x)
 >>> d['.\sync_pics.py']
 1135900993

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to