标签:pre copy 打印 import name 浅拷贝 list port print
import copy
person = [‘name‘,[‘a‘,100]]
p1 = copy.copy(person)
p2 = person[:]
p3 = list(person)
person[0] = ‘kk‘
p4 = person
print(p1)
print(p2)
print(p3)
print(p4)
打印:
[‘name‘, [‘a‘, 100]]
[‘name‘, [‘a‘, 100]]
[‘name‘, [‘a‘, 100]]
[‘kk‘, [‘a‘, 100]]
标签:pre copy 打印 import name 浅拷贝 list port print
原文地址:https://blog.51cto.com/6968567/2422179