在python中,fuction id()返回对象的内存地址。 (https://docs.python.org/2/library/functions.html#id)和在python中,如果两个变量具有相同的值,那么它们是否具有相同的地址?
In [30]: a = 'asdf'
In [31]: hex(id(a))
Out[31]: '0x1082caa08'
In [32]: b = 'asdf'
In [33]: hex(id(b))
Out[33]: '0x1082caa08'
In [34]: c = 2
In [35]: hex(id(c))
Out[35]: '0x1067295c0'
In [36]: d = 2
In [37]: hex(id(d))
Out[37]: '0x1067295c0'