这里我做错了什么?字典内的附加似乎无法正常工作。
我收到了一个错误消息:
“AttributeError: 'dict' object has no attribute 'append'”
这意味着你正在尝试在字典对象上使用“append”方法,但是字典并没有该属性。
final = []
topid = {
"ida" : "ida",
"idb" : "idb",
"idc" : "idc",
"subid" : {}
}
for subid in subids:
insubid = {
"name" : subid.name,
"sida" : "sida",
"sidb" : "sidb",
"sidc" : "sidc",
}
topid["subid"].append(insubid)
final.append(topid)
我收到了一个错误消息:
“AttributeError: 'dict' object has no attribute 'append'”
这意味着你正在尝试在字典对象上使用“append”方法,但是字典并没有该属性。
dict.update()
函数? - S.Lott