#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
9 个解决方案
#1
#!/usr/bin/python
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#2
#!/usr/bin/python
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#3
#!/usr/bin/python
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#4
字串应该用json.load(Res)...
#5
json.loads(Res)...
#6
连着贴了四段代码,你是要问四个问题还是一个问题?
#7
"create_time":你好
至少这里应该错的,无法解析成json的。
至少这里应该错的,无法解析成json的。
#8
try:
#9
json.load(filename)
json.loadds(string)
一个从文件加载,一个从内存加载
json.loadds(string)
一个从文件加载,一个从内存加载
#1
#!/usr/bin/python
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#2
#!/usr/bin/python
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#3
#!/usr/bin/python
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#coding=gbk
import os
import json
Res='[{"brief":"ooooo","class_extid":13,"create_time":你好,"face_id":4,"flag":6777217,"flag_ext":0,"level":0,"max_member":100,"memo":"m~F~M0m~Zm~@~B","name":"10502","option":2,"ul":[{"flag":4,"u":285},{"flag":4,"u":35}]}]'
qDic = json.load(Res)
print qDic
for i in qDic:
print i["class_extid"]
print i["flag"]
for j in i["ul"]:
print str(j["flag"]) + "===" + str(j["u"])
执行后报错:
Traceback (most recent call last):
File "my.py", line 7, in <module>
qDic = json.load(Res)
File "/usr/lib/python2.6/json/__init__.py", line 264, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
请高手指点,万分感谢
#4
字串应该用json.load(Res)...
#5
json.loads(Res)...
#6
连着贴了四段代码,你是要问四个问题还是一个问题?
#7
"create_time":你好
至少这里应该错的,无法解析成json的。
至少这里应该错的,无法解析成json的。
#8
try:
#9
json.load(filename)
json.loadds(string)
一个从文件加载,一个从内存加载
json.loadds(string)
一个从文件加载,一个从内存加载