【Python】列表的复制
2021-06-04 12:04
标签:pre style code python app 列表 color div pen 上面表明了如何对列表做复制操作; 【Python】列表的复制 标签:pre style code python app 列表 color div pen 原文地址:https://www.cnblogs.com/LeeCookies/p/14652312.html>>> 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]