逻辑运算符

>>>a=10
>>>b=20
>>>a and b
20
#如果a为 False,a and b 返回 False,否则它返回b的计算值。

 

 
 
>>>a or b
10
#如果a是非 0,它返回 a 的值,否则它返回 b 的计算值。

 

 
>>>not a
False
 
>>>not b
False
 
>>>not -1
False
 
>>>not False
True
 
>>>not True
False
#如果 x 为 True,返回 False 。如果 x 为 False,它返回 True。

end

 
posted @ 2017-10-11 16:34  爱你无目的  阅读(112)  评论(0)    收藏  举报