小编Pra*_*lka的帖子

Python 运算符:数学优先级比较运算符与相等运算符

print 1>0 == (-1)<0           # => False
print (1>0) == ((-1)<0)       # => True
Run Code Online (Sandbox Code Playgroud)

第一行打印 False。第二行打印 True

问题是,根据顺序,比较运算符是否高于相等运算符。

这两行不都应该打印 True 吗?(或者至少是同样的事情..)

https://www.codecademy.com/en/forum_questions/512cd091ffeb9e603b005713

python operator-precedence python-2.7

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

标签 统计

operator-precedence ×1

python ×1

python-2.7 ×1