python的列表拷贝
1.拷贝一个列表必须使用切片操作符拷贝看下面的结果,与预想之差异
print ('Simple Assignment')
shoplist = ['apple','mango','carrot','banana']
mylist = shoplist
del shoplist[0]
print (' shoplist is ', shoplist)
print ('mylist is ' ,mylist)
print ('Copy by making a full slice')
mylist = shoplist[:]
del mylist [0]
print ('shoplist is ',shoplist)
print ('mylist is ',mylist)