First Chapter

https://docs.python.org/3/tutorial/datastructures.html

list lst = [1,3,4] ls2 = lst ls2[1] = 2 print (ls2,lst) ([1, 2, 4], [1, 2, 4]) 浅复制

>>> lst = [1,3,5]
>>> ls2 = lst.copy()
>>> ls2
[1, 3, 5]
>>> ls2[1] = 3
>>> lst
[1, 3, 5]
>>> ls2
[1, 3, 5]
>>> ls2[1] = 1000
>>> ls2
[1, 1000, 5]
>>> lst
[1, 3, 5]

results matching ""

    No results matching ""