Python id()

Configurare noua (How To)

Situatie

The id() method returns a unique integer (identity) of a passed argument object.

Solutie

Pasi de urmat

print(“id of 5 =”, id(5))

a = 5

print(“id of a =”, id(a))

b = a

print(“id of b =”, id(b))

c = 5.0

print(“id of c =”, id(c))

Output:

id of 5 = 140472391630016
id of a = 140472391630016
id of b = 140472391630016
id of c = 140472372786520

Tip solutie

Permanent

Voteaza

(2 din 6 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?