运行如下代码
l = [{}, {}, {}]
for k in l:
k[1] = 1
print(l)
输出为
[{1: 1}, {1: 1}, {1: 1}]
运行如下代码
l = [{}, {}, {}]
for k in l:
k = {1:1}
print(l)
输出为
[{}, {}, {}]
运行如下代码
l = [1,2,3]
for k in l:
k = k * 2
print(l)
输出为
[1, 2, 3]