在for循环中,我有一个像这样的字典对象:
mob1 = {
"Item": item1,
'Price': price1,
'Desc': desc1
}
Run Code Online (Sandbox Code Playgroud)
我尝试将其附加为:
list.append(mob1)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Traceback (most recent call last):
File "/home/turbolab/Documents/python_test/Sep 23 data_to_json test.json", line 32, in <module>
list.append(mob1)
TypeError: descriptor 'append' requires a 'list' object but received a 'dict'
Run Code Online (Sandbox Code Playgroud) python ×1