python_test_01

01

  以下程序输出的结果为:
    I = []
    for i in range(4):
        I.append({"num":i})
    print(I)

输出为 : [{‘num’: 0}, {‘num’: 1}, {‘num’: 2}, {‘num’: 3}]

02

I=[]
a={"num":0}
for i in range(4):
    a["num"] = i
    I.append(a)
print(I)

输出为 : [{‘num’: 3}, {‘num’: 3}, {‘num’: 3}, {‘num’: 3}]

猜你喜欢

转载自blog.csdn.net/weixin_44786482/article/details/88824032