小编New*_*Pis的帖子

比较python中的两个布尔表达式

In[19]: x = None
In[20]: y = "Something"
In[21]: x is None == y is None
Out[21]: False
In[22]: x is None != y is None ## What's going on here?
Out[22]: False
In[23]: id(x is None)
Out[23]: 505509720
In[24]: id(y is None)
Out[24]: 505509708
Run Code Online (Sandbox Code Playgroud)

为什么Out [22]错了?他们有不同的ID,所以这不是身份问题....

python

3
推荐指数
1
解决办法
93
查看次数

标签 统计

python ×1