+ 2
how I can find in python place of variable in memory?
e.g. in c++ it is &var
5 Answers
+ 2
Did you meant in hexadecimal format?
Here you go: print(hex(id(x)))
+ 2
@Michael
After a lot of research on this, I ended up with a new code:
https://code.sololearn.com/cie404S1Rr1c/?ref=app
+ 1
In Python, you have an id() function to help you.
x = 1
print(id(x)) # prints memory location of x
+ 1
hex is format from id, but id is only identical number and not the address in memory)
0
I think for id is only identical number, but please in memory save in hexadecimal format?!..