-
-
Save IndhumathyChelliah/c0586f2892b76b3f1fbcf9997e40feda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
x=[1,2,[3,4]] | |
#deepcopying x | |
y=deepcopy(x) | |
#Both contain same list elements | |
print (x)#Output:[1, 2, [3, 4]] | |
print (y)#Output:[1, 2, [3, 4]] | |
#Both are different list objects.Their id (memory location) is different. | |
print (id(x))#Output:40211720 | |
print (id(y))#Output:40343976 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment