请问python的is和is not运算符是干什么用的
4 回答

慕的地6264312
TA贡献1817条经验 获得超6个赞
x in S 运算符用来检测对象 x 是否等于序列 S 中的任何项目;
如果存在相等的项目,则返回 True;否则返回 False;
x not in S 运算符与 not( x in S)是等价的;
in 和 not in 都属于 python 序列运算中的成员测试运算符;

拉风的咖菲猫
TA贡献1995条经验 获得超2个赞
用来判断对象的身份的 根据内置函数id
1 2 3 4 5 6 7 8 9 | >>> a=1 >>> b=1.0 >>> a==b True >>> a is b False >>> id(a), id(b) (1639444272, 4434608) >>> |
添加回答
举报
0/150
提交
取消