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]]
import copy
list1 = ['A', 'B', 'C']
list2 = copy.deepcopy(list1)
print(list2)
import copy
list_to_copy = ['a', 2, 'foo']
new_deepcopy = copy.deepcopy(list_to_copy)