Value changing at multiple positions in a list of list when trying to change at one place

后端 未结 2 373
遇见更好的自我
遇见更好的自我 2021-01-20 20:54

The following Code in python:

matrix = [[0]*3]*2
matrix[0][1] = 1

seeems to be changing the value at all the matrix[][1]th pos

2条回答
提交回复
热议问题