【Python】列表的复制


	【Python】列表的复制
[编程语言教程]

>>> list_a=[1,2,3,4]
>>> list_a
[1, 2, 3, 4]
>>> list_b=list_a
>>> list_b
[1, 2, 3, 4]
>>> list_a.append(1)
>>> list_a
[1, 2, 3, 4, 1]
>>> list_b
[1, 2, 3, 4, 1]
>>> list_c=list_a[:]
>>> list_c
[1, 2, 3, 4, 1]
>>> list_a.append(9)
>>> list_a
[1, 2, 3, 4, 1, 9]
>>> list_b
[1, 2, 3, 4, 1, 9]
>>> list_c
[1, 2, 3, 4, 1]

上面表明了如何对列表做复制操作;

【Python】列表的复制

原文地址:https://www.cnblogs.com/LeeCookies/p/14652312.html