Append of lists in Python
问题 A strange append of list in python. Here I defined a class class test: group = [] def __init__(self,name): self.name = str(name) Then I write those test0 = test(0) test1 = test(1) test_list = [test0, test1] I want to save test1.name into test0.group test_list[0].group.append(test_list[1].name) I print test0.group , it's ['1'] , everything is OK. But while I want to save test0.name into test1.group test_list[1].group.append(test_list[0].name) Then I print test1.group , it's ['1','0'] . I don't