xxxxxxxxxx
a = [0,1,2,3,4,5,6,7,8,9,10]
b = a[:] #deep copying the list a and assigning it to b
xxxxxxxxxx
from copy import deepcopy
if __name__ == '__main__':
x = [1, 2]
y = [x, x]
# create a copy of list y
clone = deepcopy(y)
# remove the last item from the original list
x.pop()
# cloned list remains unchanged
print(clone) # [[1, 2], [1, 2]]
xxxxxxxxxx
import copy
list_to_copy = ['a', 2, 'foo']
new_deepcopy = copy.deepcopy(list_to_copy)