itemsInExistence = [{'name': 'Tester','stats': 1,'rank': 1,'amount': 1},{'name': 'Mk II Death','stats': 10,'rank': 5,'amount': 3}]
def save_list2():
f = open('all_items.txt','w')
ii = 0
for item in itemsInExistence:
print(f.write(itemsInExistence[ii][0],''))
f.write(itemsInExistence[ii][1] + ' ')
f.write(itemsInExistence[ii][2] + ' ')
f.write(itemsInExistence[ii][3] + '\n')
ii += 1
在说f.write(itemsInExistence [ii] [0],'')的地方,给了我错误
KeyError:0
这是为什么,这是什么意思?有什么办法可以解决这个问题?