2009/1/14 Jon Crump <jjcr...@myuw.net>:
>>>> b = """{"aKey" : "a value with \"literal quotes\" in it"}"""
>>>> eval(b)
>
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "<string>", line 1
>    {"aKey" : "a value with "literal quotes" in it"}
>                                   ^
> SyntaxError: invalid syntax

Is it an option to just do:

>>> b = """{'aKey':'a value with "literal quotes" in it'}"""
>>> eval(b)
{'aKey': 'a value with "literal quotes" in it'}

?

(or, heck, get rid of eval.. do you really need it?)

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to