Keywords
python3.7共有33个关键词,分别是
False True None and as assert break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try white with yield
不同python版本有不同的关键词。
获得关键词的方法如下:
import keyword
print(keyword.kwlist)
True
&False
在python中具有真值,常用于比较运算(comparison operation)和逻辑运算(logical / Boolean operations)。
例
>>> 3 == 3
True
>>> 5 >= 3
True
>>> 10 <= 1
False
>>> print(5 - (3 < 7))
5
>>> print(1 + (5 == 5))
2
>>> True or False
True
>>> True and False
False