alist=[3,5,7]
blist=alist[:]
alistblist
true
alist is blist
false
blist[1]=8
blist
[3,8,7]
alist
[3,5,7]
alist=[3,[5],7]
blist=alist[:]
blist[1].append(6)
blist
[3,[5,6],7]
alist
[3,[5,6],7]
alist=[3,[5],7]
import copy
blist=copy.deppcopy(alist)
alistblist
True
alist is blist
false
blist[1].append(6)
blist
[3,[5,6],7]
alist
[3,[5],7]
2021-03-21
最新推荐文章于 2021-11-21 12:10:25 发布