中央电大形考平台,兰炼二中贴吧,前面板没有声音
与运算:只有两个布尔值都为 True 时,计算结果才为 True。
True and True # ==> True True and False # ==> False False and True # ==> False False and False # ==> False
或运算:只要有一个布尔值为 True,计算结果就是 True。
True or True # ==> True True or False # ==> True False or True # ==> True False or False # ==> False
非运算:把True变为False,或者把False变为True:
not True # ==> False not False # ==> True
与java中的运算符关系
and类似于&&
or类似于||
not类似于~
学过其他语言的应该一看就懂了,还有一个比较特殊的.
python把 0 ,空字符串''和None当做False处理,其他数值与非空字符串都当做true处理
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
新手学习Python2和Python3中print不同的用法
Python基于os.environ从windows获取环境变量
网友评论