片段
import json
teststr = '{"user": { "user_id": 2131, "name": "John", "gender": 0, "thumb_url": "sd", "money": 23, "cash": 2, "material": 5}}'
json = json.load(teststr)
Run Code Online (Sandbox Code Playgroud)
抛出一个例外
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'str' object has no attribute 'loads'
Run Code Online (Sandbox Code Playgroud)
如何解决问题?