# Direct assignment, after which the variable is applied to the same ID () address, and subsequent modifications will be used to drink also modified
num1=[1,2,3,4]
Num2=num1
Print (ID (NUM1))
Print (ID (num2))
num2[0]=111
Print (NUM1)
Print (NUM2)
#深拷贝 completely open up new space, modify the value after copy, the value will not be affected
Import Copy
num1=[1,2,3,4]
Num2=copy.deepcopy (NUM1)
Print (NUM1,NUM2)
Print (ID (NUM1))
Print (ID (num2))
num2[0]=111
Print (NUM1,NUM2)
# Shallow copy only if the list exists in the sub-list, its child list ID () is the same, and subsequent modifications to the values in the sub-list will be modified initially
num1=[1,2,3,4,[5,6,7]]
Num2=copy.copy (NUM1)
Print (NUM1,NUM2)
Print (ID (NUM1))
Print (ID (num2))
Print (ID (num1[-1)))
Print (ID (num2[-1)))
num2[-1][0]=[8,9,0]
Print (NUM1)
Print (NUM2)
Pre-Python 4--depth copy and direct assignment