Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 26, 2020 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/b764c08956f120daf52d115b1f9dbeb8 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/b764c08956f120daf52d115b1f9dbeb8 to your computer and use it in GitHub Desktop.
from copy import deepcopy
x=[1,2,[3,4]]
#deepcopying x
y=deepcopy(x)
#Nested list inside list x and y also different list objects.Their id (memory location) is different.
print (id(x[2]))#Output:52662600
print (id(y[2]))#Output:52795592
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment