Be the first to know about special offers and new products for web developers and Internet business owners.
I will never share your email address with the bad boys. Period.
|
Be the first to know about special offers and new products for web developers and Internet business owners. I will never share your email address with the bad boys. Period.
The latest
Recent comments
|
Quotes causing problem with Python and simplejson
Submitted by alexis on Fri, 2008-10-17 16:47.
My application will receive a string of JSON and transform it to a dictionary, pretty simple. Let's run a test first, starting with the Python shell, or better yet, iPython, and importing the module:
Now let's define a string using JSON notation and pass it to simplejson:
And we get a ValueError exception. Let's try using simple quotes for enclosing the whole string and double quotes for the JSON keys and values:
And there you go, no error now:
I find a little strange that this problem happens as I've been using either type of quotes for most of my Python coding. Had you noticed this problem? I've checked simplejson's documentation and could not find anything related to this. One last word, the new Python 2.6 includes a json module, which is a refactored simplejson. Neat. Trackback URL for this post:http://www.ventanazul.com/webzine/trackback/123
|
Want to launch a online store, need a new look for your website, market your services on the Net or build a virtual community? Not a problem, let's talk about it. Where To Host Your Sites? |
Post new comment