copy

浅copy

import copy
n1 = {'k1':'wu','k2':123,'k3':['alex',678]}
n3 = copy.copy(n1)
print(n1,n3)
View Code

深copy

import copy
n1 = {'k1':'wu','k2':123,'k3':['alex',678]}
n4 = copy.deepcopy(n1)
print(n1,n4)
View Code

 

posted @ 2019-07-24 21:58  套你大象  阅读(166)  评论(0编辑  收藏  举报