python逻辑判断 () not and or

python学习网 2018-04-11 06:00:05

python逻辑判断 () not and or

优先级关系:()>not>and>or

运算符示意

  • not –表示取反运算。
  • and –表示取与运算。
  • or –表示取或运算。

or 是逻辑或,其值为:a ,b至少一个为True,则a or b为True
and 是逻辑与,其值为:a,b 只要有一个为False ,则a and b为False
因此 0 or 0=0
0 and 1=0

注:BOOL为布尔型用作逻辑判断, 0为FALSE,1为TRUE。

阅读(767) 评论(0)