list1 = list2 = [] If it is initialized like this, the reference will be copied. Don't panic, don't rush list1 = [] list2 = [] Should be like
test.py
>>> list1 = list2 = []
>>> list1.append(1)
>>> list2.append(2)
>>> print list1
[1, 2]
Recommended Posts