我正在尝试转换使用urllib3从http请求生成的字符串.
Traceback (most recent call last):
File "", line 1, in
data = json.load(data)
File "C:\Python27\Lib\json\__init__.py", line 286, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
>>> import urllib3
>>> import json
>>> request = #urllib3.request(method, url, fields=parameters)
>>> data = request.data
现在……当尝试以下内容时,我得到了这个错误……
>>> json.load(data) # generates the error
>>> json.load(request.read()) # generates the error
运行类型(数据)和类型(data.read())都返回< type'str'>
data = '{"subscriber":"0"}}\n'