Python 3.x 在Python中如何使用id()函数?
我是Python的初学者。我想知道Python 3.x 在Python中如何使用id()函数?,python-3.x,encryption,Python 3.x,Encryption,我是Python的初学者。我想知道id()函数是否可以 用于加密程序,还是仅用于在内存中为该值提供元素id 我只是想知道我如何使用这个函数,以及 在某些情况下,它是好用的。以下是一个例子: Input : id(1025) # 1025 is a value stored in memory Output : 140365829447504 or Input : id("geek") # A string literal is stored in memory Output : 1
id()
函数是否可以
用于加密程序,还是仅用于在内存中为该值提供元素id
我只是想知道我如何使用这个函数,以及
在某些情况下,它是好用的。以下是一个例子:
Input : id(1025) # 1025 is a value stored in memory
Output : 140365829447504
or
Input : id("geek") # A string literal is stored in memory
Output : 139793848214784
id()
函数只给出内存中Python对象的标识。从文档中:
返回对象的“标识”。这是一个整数,保证该对象在其生存期内唯一且恒定。两个生命周期不重叠的对象可能具有相同的id值
因此,这不应该用于加密