python中的逻辑运算符
Python3学习三之运算符
Python3的运算符跟Java、C的很相似,这里只说一下逻辑运算符。
Python的逻辑运算符
and | x and y | 如果x为false,返回false,否则返回y的值 |
or | x or y | 如果x为true,返回true,否则返回y的值 |
not | not x | 如果x为true返回false,如果x为false返回true |
Python的成员运算符
in | x in y | 如果x在y序列(string,list,set)中,返回true |
not in | x not in y | 如果x不在y序列中,返回true |