Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Shallow vs Deep Copy

import copy
lst = [[1,2],[3,4]]
shallow = copy.copy(lst)
deep = copy.deepcopy(lst)
lst[0][0] = 99
print(shallow)  # [[99, 2], [3, 4]]
print(deep)     # [[1, 2], [3, 4]]