python中查看變量內存地址的方法
- 2020 年 1 月 10 日
- 筆記
本文實例講述了python中查看變量內存地址的方法。分享給大家供大家參考。具體實現方法如下:
這裡可以使用id
>>> print id.__doc__ id(object) -> integer Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.) >>> >>> A=2 >>> B=3 >>> id (A) 505910880 >>> id(B) 505910896 >>> a=A >>> id(a) 505910880 >>> a==A True >>> A=4 >>> id (A) 505910912 >>> a==A False
希望本文所述對大家的Python程序設計有所幫助.