Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Adding a new nested object in the list using a Deep copy in Python

import copy
list1 = [[9, 8, 7], [6, 5, 4], [3, 2, 1]]
list2 = copy.deepcopy(list1)
list1[1][1] = 10
print("Old list:", list1)
print("New list:", list2)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Adding #nested #object #list #Deep #copy #Python
ADD COMMENT
Topic
Name
4+2 =