Copying objects with constructors in Python

后端 未结 0 1221
孤城傲影
孤城傲影 2020-11-27 12:36

In Python, certain built-in objects can be copied using their constructor function.

For lists:

l1 = []
l2 = list(l1)
print(id(l1))
print(id(l2))


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题