我有一个Python函数的一部分,如:
for item in passedList:
tempDict = {}
tempDict ["first"] = item[0]
tempDict ["second"] = item[1]
tempDict ["third"] = item[2]
我期待的是:
{'first': 'item1', 'second': 'item2', 'third': 'item3'}
但是,我得到了:
{'second': 'item2', 'first': 'item1', 'third': 'item3'}
这可能是一个非常简单的疏忽,但是对于为什么会发生这种情况有什么想法?