I have the following piece of code
>>> no=[]
>>> matrix = [[[] for x in xrange(4)] for x in xrange(4)]
>>> no=[2]
>>> temp = no
>>> matrix[1][2].append(temp)
>>> no.append(3)
>>> matrix[1][2]
when I print matrix[1][2]
I am getting the following output:
[[2, 3]]
But what I want is:
[2]
So basically what is happening is the list is getting changed inside the matrix list if I change it afterwards. But I don't want to get it changed
How can I do it ? And why is it happening ?