dataone = 8
print(id(dataone))
datatwo = 5
print(id(datatwo))
dataone = datatwo
print(dataone)
print(dataone is datatwo)
结果
C:\Python27\python.exe D:/python_one/myfirst.py/mytest4.py
42689232
42689304
5
True
Process finished with exit code 0
dataone = 8
print(id(dataone))
datatwo = 5
print(id(datatwo))
dataone = datatwo
print(dataone)
print(id(dataone))
print(dataone is datatwo)
结果
C:\Python27\python.exe D:/python_one/myfirst.py/mytest4.py
42689232
42689304
5
42689304
True
Process finished with exit code 0