Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Copy an Object in Python using = operator

list1 = [['a', 8, 7], [6, 5, 4], [3, 2, 1]]
list2 = list1
list2[0][0] = 9
print('Old List:', list1)
print('ID of Old List:', id(list1))
print('New List:', list2)
print('ID of New List:', id(list2))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Copy #Object #Python #operator
ADD COMMENT
Topic
Name
7+5 =