Python中 if not 用法
2017-12-25 11:09
295 查看
not与逻辑判断句if连用,代表not后面的表达式为False的时候,执行冒号后面的语句。比如:
a = False
if not a: (这里因为a是False,所以not a就是True)
print "hello"
这里就能够输出结果hello
a = None同理
a = False
if not a: (这里因为a是False,所以not a就是True)
print "hello"
这里就能够输出结果hello
a = None同理
相关文章推荐
- Python之Lambda表达式和if not...else用法
- Python入门教程之if语句的用法
- Python中的if、else、elif语句用法简明讲解
- python中if __name__ == "__main__":用法解析
- 关于python中的 if __name__== "__main__"用法
- Python中if __name__ == "__main__":用法解析
- android Monkeyrunner:Python语法知识学习(for,while,if用法实例)
- python中if __name__ == "__main__":用法解析
- python中if __name__ == "__main__":用法解析
- python中not的用法
- python代码`if not x:` 和`if x is not None:`和`if not x is None:`使用
- python代码`if not x:` 和`if x is not None:`和`if not x is None:`
- python robotframework用法及"wxpython not found"和“no browser is open”问题解决
- Python学习笔记(二)if语句的简单用法
- python中if __name__ == "__main__":用法解析
- python代码`if not x:` 和`if x is not None:`和`if not x is None:`使用
- Python中的if、else、elif语句用法简明讲解
- PyThon---if-elif-else用法
- 英语口语练习十九之I'm not sure if... (我不确定是否……)的用法
- python代码`if not x:` 和`if x is not None:`和`if not x is None:`使用