[Tutor] Dictionary from a text file

Danny Yoo dyoo at hashcollision.org
Thu Oct 31 18:24:23 CET 2013


>
>
> Note: in* 'call' : Update* ,Update it is a function defined in my python
> script. My dictionary is too large so i taught rather than using directly
> in python program I save it in a text file and when needed i assign it to
> dictionary object . How can i assign this text file to dictionary object
> and call it?
>
>
To introduce some terms: you are "serializing" some data --- your
dictionary --- to disk and back.  There are a few libraries that help you
do the hard work of translating the nested dictionary structure to some
flat string; in addition, they almost always includes a parser to go back
from that flat string back to the nested dictionary structure.  The 'json'
library that Petter Otten suggests is one of these serialization libraries.
 Try looking into that and see if you can just take advantage of it.

Are there other consumers for this data besides just your program?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131031/c5749bc7/attachment-0001.html>


More information about the Tutor mailing list