How to create a dictionary from a string?

Clodoaldo Pinto clodoaldo.pinto at gmail.com
Fri Apr 21 20:06:56 EDT 2006


Is there a simple way to build a dictionary from a string without using
eval()?

>>> s = '{"a":1}'
>>> d = eval(s)
>>> d
{'a': 1}

Regards, Clodoaldo Pinto




More information about the Python-list mailing list