Copying a list using deepcopy() in python

55

import copy
list1 = [[9, 8, 7], [6, 5, 4], [3, 2, 1]]
list2 = copy.deepcopy(list1)
print("Old list:", list1)
print("New list:", list2)

Comments

Submit
0 Comments