编程语言
首页 > 编程语言> > python 深度拷贝deepcopy()

python 深度拷贝deepcopy()

作者:互联网

import copy
params = self.query()
lis = [{"code": "3","value": "WW", "seq_sign":"w","status":0},{"code": "4","value": "QQ", "seq_sign":"w","status":0}]
lis2 = []
default = {"code": "", "value": "", "seq_sign": "", "status": 0}
for i, j in enumerate(params['data']):
    print(i, j)
    default.update(j)
    lis[i] = copy.deepcopy(default)
    print(lis2)
    print(i, lis[i])
    print(lis)
# params['data'] = default.update(params['data'])
params['data'] = lis

标签:code,python,default,params,lis,print,deepcopy,拷贝,data
来源: https://blog.csdn.net/Silentli20/article/details/114698164