I have a list a=[[1]] and b=[i for i in a]. Now i do b[0].append(2). When I print a and b, they are the same [[1, 2]] and [[1, 2]]. Looks like the list b[0] is referencing to the same one in a. Why does this happen?
a=[[1]]
b=[i for i in a]
b[0].append(2)
print a,b
Output: [[1, 2]] [[1, 2]]