Convert String to Dictionary question
Quinn Dunkan
quinn at hurl.ugcs.caltech.edu
Thu Feb 14 17:23:12 EST 2002
More information about the Python-list mailing list
Thu Feb 14 17:23:12 EST 2002
- Previous message (by thread): Convert String to Dictionary question
- Next message (by thread): Convert String to Dictionary question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 14 Feb 2002 21:27:48 +0000, John J. Lee <jjl at pobox.com> wrote: >On Thu, 14 Feb 2002, MDK wrote: > >> I saved my dictionary {'hello1': [1, 0, 0]} to a file. >> >> When I do a readline the I get back a string. >> >> How do I convert this string to a dictionary? > >You probably don't want to. Read the documentation for the pickle module. Or if you do, say because 'repr' format is more human readable than pickle, do 'd = eval(fp.readline())'. As always with eval(), if bad guys can edit your file, you're in trouble. Of course, if they can edit your pickle, you're in trouble too.
- Previous message (by thread): Convert String to Dictionary question
- Next message (by thread): Convert String to Dictionary question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list