赋值,深拷贝,浅拷贝
a)Import copy引入拷贝模块
b)list1 = [1,2,[3,4]]
c)list2 = list1(这是赋值)
d)list3 = copy.copy(list1)(这是浅拷贝)
e)list4 =copy.deepcopy(list1)(这是深拷贝)
f)list1 is list2 (True)/
list1 is list3 (False)/
list1a is list4(False)
g)list1.appnd(5)/
h)list1[2].append(6)
i)list1 = [1,2,5,[3,4,6]]
j)list2 = [1,2,5,[3,4,6]]
k)list3 = [1,2,[3,4,6]]
l)list4= [1,2,[3,4]]
网友评论