Python id() Function
The Python id() function returns a unique id of the specified object. The id is the memory address of the object and it changes every time the program is executed. The id of an object is unique and constant during it's lifetime. Two objects with non-overlapping lifetimes may have the same id() value.
In the below example, the id() function returns the unique id of list called MyList and it's elements. These ids gets changed every time the program is executed.
MyList = [10, 'Python'] print(id(MyList)) print(id(MyList)) print(id(MyList))
The output of the above code will be:
140437121242248 94259487597280 140437121126728
❮ Python Built-in Functions