How to deep copy a list?

前端 未结 8 1379
旧巷少年郎
旧巷少年郎 2020-11-22 03:07

I have some problem with a List copy:

So After I got E0 from \'get_edge\', I make a copy of E0 by calling \'E0_copy =

8条回答
  •  误落风尘
    2020-11-22 03:32

    Regarding the list as a tree, the deep_copy in python can be most compactly written as

    def deep_copy(x):
        if not isinstance(x, list): return x
        else: return map(deep_copy, x)
    

提交回复
热议问题