deepcopy list,dict
写9418作业时,复制一个字典,结果发现在新字典上操作一直会修改老字典
才发现需要是没有将value的地址也改过来 GG
newDict = {k:v[:] for k,v in d.items()}
https://stackoverflow.com/questions/5105517/deep-copy-of-a-dict-in-python
写9418作业时,复制一个字典,结果发现在新字典上操作一直会修改老字典
才发现需要是没有将value的地址也改过来 GG
newDict = {k:v[:] for k,v in d.items()}
https://stackoverflow.com/questions/5105517/deep-copy-of-a-dict-in-python