Professional Documents
Culture Documents
Class 8 To Class 9 Shallow and Deep Copying
Class 8 To Class 9 Shallow and Deep Copying
COPYING
Learning outcomes
To understand the copying techniques in
python
To apply Shallow and Deep copying in python
Copy an Object in Python
new_list[2][2] = 9
import copy
copy.copy(x)
copy.deepcopy(x)
Here, the copy() return a shallow copy of x.
import copy
import copy
old_list.append([4, 4, 4])
import copy
old_list[1][1] = 'AA'
import copy
import copy
old_list[1][0] = 'BB'