标签:dict pen item 嵌套 enum return end ems 拷贝
深拷贝是将对象全拷贝,包括嵌套对象
def deepcopy(cls): if isinstance(cls, dict): dct = {} for k, v in cls.items(): dct[k] = deepcopy(v) return dct elif isinstance(cls, list or type): li = [] for index, item in enumerate(cls): li.append(deepcopy(item)) return li else: return cls
标签:dict pen item 嵌套 enum return end ems 拷贝
原文地址:https://www.cnblogs.com/zwq-/p/10800196.html