无论是浅拷贝还是深拷贝都需要导入拷贝模块:

import copy

1、浅拷贝:

new=copy.copy(old)

2、深拷贝:

new=copy.deepcopy(old)

参考链接

  1. ​​Python的复制,深拷贝和浅拷贝的区别​​