Python Gotcha's?

Chris Angelico rosuav at gmail.com
Thu Apr 5 07:37:04 EDT 2012


On Thu, Apr 5, 2012 at 9:06 PM, Duncan Booth
<duncan.booth at invalid.invalid> wrote:
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
>
>> JSON expects double-quote marks, not single:
>>     v = json.loads("{'test':'test'}")  fails
>>     v = json.loads('{"test":"test"}')  succeeds
>>
>
> You mean JSON expects a string with valid JSON?
> Quelle surprise.

The surprise is between JSON and JavaScript (the latter does accept
single quotes), and Python is correctly implementing the JSON spec.

ChrisA



More information about the Python-list mailing list