The*_*uhn 12 python operators
我今天在编写Python时意识到可以将不等式运算符编写为a!=b或not a==b.这让我很好奇:
a!=b
not a==b
Ign*_*ams 18
==
__eq__()
!=
__ne__()
not ==
Jus*_*son 10
请注意你的括号.
>>> not "test" == True True >>> not "test" and True False
==优先于not.但是not,and具有相同的优先权,所以
not
and
Python运算符优先级
归档时间:
13 年,9 月 前
查看次数:
18414 次
最近记录: