NEWB: how to convert a string to dict (dictionary)

Heiko Wundram me+python at modelnine.org
Wed May 24 02:52:22 EDT 2006


Am Mittwoch 24 Mai 2006 07:52 schrieb manstey:
> Hi,
>
> How do I convert a string like:
> a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
>
> into a dictionary:
> b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}

b = eval(a)

(if a contains a dict-repr)

--- Heiko.



More information about the Python-list mailing list