我是python的新手,请看下面的代码
n = 5
m = 5
mat = [[0]*m]*n
print(mat)
i = 0
while(i < m):
mat[0][i] = i
i += 1
print(mat)
这个代码给出的输出类似于-
[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
[[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2,