接收一个post的json字符串:
s={"username":"admin","password":"password","tenantid":""}
使用python自带的json库
import json
>>> a=json.loads(s)
Traceback (most recent call last):
File " ", line 1, in
File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer
>>> ok,问题解决
查看更多关于python中json对象转换出错解决方法的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did86836