2013-10-18 10:07:03| import copy a = [1,2,3,['a','b']] b = a c = a[:] d = copy.copy(a) e = copy.deepcopy(a) print "a ",a print "= ",b print "[:] ",c print "copy ",d print "deepcop…
将一个列表的数据复制到另一个列表中.使用列表[:],可以调用copy模块 import copy A = [21,22,23,24,['a','b','c','d'],25,26] B = A #直接赋值 C = A[:] #浅拷贝 D = copy.copy(A) #浅拷贝 E = copy.deepcopy(A) #深拷贝 #看看深拷贝与浅拷贝的区别 #在A数组的最尾处加一个数 A.append(99) #在A数组里面的数组最尾处加一个数 A[4].append(66) print("起始列…