id() #查看内存地址name = ‘alex‘name1 = ‘alex‘print(id(name)) #31302632print(id(name1)) #31302632 is #查看是不是一个 通过内存地址 print(name == name1) == 查看等号两边的值 def func(): # pass #代码块1 name = ‘alex‘ print(id(name)) def func1(): # pass #代码块2 name = ‘alex‘ print(id(name)) func()func1() 多个代码块中是可以使用小数池 代码块中 有个问题 就是重复使用 a = 100b = 100print(a is b) 数字-5 ~ 256 字符串 乘法总数长度不能超过20个,0和1除外 不能有特殊字符
a = ‘@‘*2b = ‘@‘*2print(a is b) a = ‘[email protected]‘b = ‘[email protected]‘print(a is b)
原文地址:https://www.cnblogs.com/q240756200/p/9898206.html
时间: 2024-11-16 22:56:38