运算符

0&0=0; 0&1=0; 1&0=0; 1&1=1

类似于 and 
 
0|0=0; 0|1=1; 1|0=1; 1|1=1    
类似于 or
 
0^0=0; 0^1=1; 1^0=1; 1^1=0
 
~0=1; ~1=0;
类似于 not
 
示例:
print (2>1) ^ (15>13)    False
print (2<1) & (15>13)   False
print (2<1) | (15>13)     True
print not 2<1              True
 
 
posted @ 2019-10-29 08:52  数之美  阅读(110)  评论(0编辑  收藏  举报