Python -- keywords

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
发布了26 篇原创文章 · 获赞 3 · 访问量 1395

猜你喜欢

转载自blog.csdn.net/qq_42937176/article/details/104010509
今日推荐