python的复制,拷贝,和深拷贝。

>>> a=[23,3]
>>> b=a
>>> b.append(234)
>>> a
[23, 3, 234]
>>> import copy
>>> a=[23,3,3,[23,3]]
>>> b= copy.copy(a)
>>> b
[23, 3, 3, [23, 3]]
>>> b[3].append(34)
>>> a
[23, 3, 3, [23, 3, 34]]
>>> b
[23, 3, 3, [23, 3, 34]]

posted on 2014-09-24 00:13  tom_zhao_vip  阅读(127)  评论(0编辑  收藏  举报