python 字典复制(存疑)
import copy x = {'a':1,'b':[2,3,4]} y = x.copy() z = copy.deepcopy(x) print(x) print(y) print(z) print('dealing'.center(25,'=')) num = 5 x['a']=5 #x['a'].append(5) 这个追加语句错误,未知 print(x) print(y) #y是浅复制字典x,字典x改变了,而为什么y没有改变 print(z)
import copy x = {'a':1,'b':[2,3,4]} y = x.copy() z = copy.deepcopy(x) print(x) print(y) print(z) print('dealing'.center(25,'=')) num = 5 x['a']=5 #x['a'].append(5) 这个追加语句错误,未知 print(x) print(y) #y是浅复制字典x,字典x改变了,而为什么y没有改变 print(z)