Python id() Function

Python 内置函数Python Built-in Functions


Description

id()The function returns the unique identifier of the object, which is an integer.

In CPython,id()the function is used to get the memory address of the object.

Syntax

id Syntax:

id([object])

Parameter Description:

  • object -- Object.

Return Value

Returns the memory address of the object.

Examples

The following example demonstrates the usage of id:

>>>a = 'example' >>> id(a) 4531887632 >>> b = 1 >>> id(b) 140588731085608

Python 内置函数Python Built-in Functions

Other Extensions