运算符 描述
lambda Lambda表达式
or 布尔“或”
and 布尔“与”
not x 布尔“非”
in,not in 成员测试
is,is not 同一性测试
<,<=,>,>=,!=,== 比较
| 按位或
^ 按位异或
& 按位与
<<,>> 移位
+,- 加法与减法
*,/,% 乘法、除法与取余
+x,-x 正负号
~x 按位翻转
** 指数
x.attribute 属性参考
x[index] 下标
x[index:index] 寻址段
f(arguments...) 函数调用
(experession,...) 绑定或元组显示
[expression,...] 列表显示
{key:datum,...} 字典显示
'expression,...' 字符串转换

 

优先级是最小面最优先、从下往上数、如果迩还不信、迩可以运行一下下面的小代码来证实

 

true = True
false = False
if not false or true:
print "yes"
else:
print "no"


##
#ture or false => true
#false or false => false
#ture or ture => true

##如果是先not后or、那么一定会返回true、也就是yes
##如果是先or后not、那么一定会返回false、也就是no、
##但结果输出了yes、证明是先not后or



相关文章:

  • 2021-08-20
  • 2021-11-29
  • 2022-01-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
相关资源
相似解决方案