python中运算符and、or、not
2013-10-24 10:20
417 查看
在python中,对于逻辑运算符and 、or、 not 需要注意一下:
and :x and y 返回的结果是决定表达式结果的值。如果 x 为真,则 y 决定结果,返回 y ;如果 x 为假,x 决定了结果为假,返回 x。
or :x or y 跟 and 一样都是返回决定表达式结果的值。
not : 返回表达式结果的“相反的值”。如果表达式结果为真,则返回false;如果表达式结果为假,则返回true。
and :x and y 返回的结果是决定表达式结果的值。如果 x 为真,则 y 决定结果,返回 y ;如果 x 为假,x 决定了结果为假,返回 x。
or :x or y 跟 and 一样都是返回决定表达式结果的值。
not : 返回表达式结果的“相反的值”。如果表达式结果为真,则返回false;如果表达式结果为假,则返回true。
相关文章推荐
- Python中运算符not、and、or
- Python中运算符not、and、or
- 【再回首Python之美】【逻辑运算】七个逻辑运算符:not, or, and, not or, not and, !=, ==
- Python 运算符(算术运算符(+,-,*,**,/,//),逻辑运算符(not , or ,and),比较运算符(>,<,>=,=<),复合运算符(+=,-=,*=,/=,**=,//=))
- python中运算符and、or、not
- 数据运算+-*/,比较运算符==!=,赋值运算,逻辑运算and,or,not,成员运算in,not in,身份运算is is not,位运算&|,运算符的优先级
- Python-回文检测和布尔操作(and,or,not)
- Python中的逻辑运算符‘and’、‘or’和‘not’
- 关于Python的and, or ,not
- Python 的 and or not 操作符
- Struts2中Could not create and/or set value back on to object的解决办法
- CareerCup Find whether a given number is a perfect square or not.(Addition and Subtraction only)
- 【转载】python 中的 and、or、and-or
- numpy: np.logical_and/or/not (逻辑与/或/非)
- python的and和or优先级
- eclipse下maven打包失败(Please ensure you are using JDK 1.4 or above and not ......
- python and or
- grep命令的or,and,not操作的例子
- python的and 和or逻辑
- Python:and和or的特殊性质