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

Kent Johnson kent at kentsjohnson.com
Wed May 24 08:07:49 EDT 2006


manstey wrote:
> 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'}

Try this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469



More information about the Python-list mailing list