不能使用upadte()等方法,因为会更新key对应的value值,根据网上靠谱的方法,用一个列表存起来字典即可。
#example
result_list = []
i = 0
for i in range(10):
temp_dict = {}
key = "test_key"
value = "test_value"
temp_dict[key] = value
result_list.append(temp_dict)
for item in result_list:
for k,v in item.items():
print(k,v)
访问结果如下: