python内置函数:id()的用法-返回对象在内存中的存储地址

    科技2022-07-16  165

    参考官方链接:https://docs.python.org/3/library/functions.html#id

    id(object)

    Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.

    CPython implementation detail: This is the address of the object in memory.

    id(object)这个函数返回的是对象在内存中的存储地址

    >>> a= 5 >>> id(a) 140734697375520

    PS:python的全部内置函数的官方链接:https://docs.python.org/3/library/functions.html

    Processed: 0.008, SQL: 8