pythonで変数メモリアドレスを表示する方法

376 ワード

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.)

使用:id(obj)id(obj)取得objのメモリアドレス(10進)
>>> sq = [0, 1, 2]
>>> print id(sq)
4345610824