原因
同事反馈一个接口返回的json数据,在python里load不出来。
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
r.json()
File "C:\Python27\lib\site-packages\requests\models.py", line 797, in json
return json.loads(self.text, **kwargs)
File "C:\Python27\lib\json\__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
查了下说是前面多了个BOM头。
- 阅读剩余部分 -