Created
December 18, 2012 09:07
-
-
Save HQMIS/4326422 to your computer and use it in GitHub Desktop.
【Python】【Library】【json】
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 | |
| Type "copyright", "credits" or "license()" for more information. | |
| >>> import json | |
| >>> json_str = "{'json':'str'}" | |
| >>> json.loads(json_str) | |
| Traceback (most recent call last): | |
| File "<pyshell#2>", line 1, in <module> | |
| json.loads(json_str) | |
| File "E:\Python27\lib\json\__init__.py", line 326, in loads | |
| return _default_decoder.decode(s) | |
| File "E:\Python27\lib\json\decoder.py", line 366, in decode | |
| obj, end = self.raw_decode(s, idx=_w(s, 0).end()) | |
| File "E:\Python27\lib\json\decoder.py", line 382, in raw_decode | |
| obj, end = self.scan_once(s, idx) | |
| ValueError: Expecting property name: line 1 column 1 (char 1) | |
| >>> json_str = '{"json":"str"}' | |
| >>> json.loads(json_str) | |
| {u'json': u'str'} | |
| >>> json_str = '{"json":"str\str"}' | |
| >>> json.loads(json_str) | |
| Traceback (most recent call last): | |
| File "<pyshell#8>", line 1, in <module> | |
| json.loads(json_str) | |
| File "E:\Python27\lib\json\__init__.py", line 326, in loads | |
| return _default_decoder.decode(s) | |
| File "E:\Python27\lib\json\decoder.py", line 366, in decode | |
| obj, end = self.raw_decode(s, idx=_w(s, 0).end()) | |
| File "E:\Python27\lib\json\decoder.py", line 382, in raw_decode | |
| obj, end = self.scan_once(s, idx) | |
| ValueError: Invalid \escape: line 1 column 12 (char 12) | |
| >>> json_str = '{"json":"str\\str"}' | |
| >>> json.loads(json_str) | |
| Traceback (most recent call last): | |
| File "<pyshell#10>", line 1, in <module> | |
| json.loads(json_str) | |
| File "E:\Python27\lib\json\__init__.py", line 326, in loads | |
| return _default_decoder.decode(s) | |
| File "E:\Python27\lib\json\decoder.py", line 366, in decode | |
| obj, end = self.raw_decode(s, idx=_w(s, 0).end()) | |
| File "E:\Python27\lib\json\decoder.py", line 382, in raw_decode | |
| obj, end = self.scan_once(s, idx) | |
| ValueError: Invalid \escape: line 1 column 12 (char 12) | |
| >>> json_str = '{"json":"str\\\\str"}' | |
| >>> json.loads(json_str) | |
| {u'json': u'str\\str'} | |
| >>> |
Author
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
关于ValueError: Expecting property name: http://bugs.python.org/issue5067