Python1基础-关键字
查看Python中的关键字
import keyword
print(keyword.kwlist)
输出:
[‘False’, ‘None’, ‘True’, ‘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’, ‘while’, ‘with’, ‘yield’]
Python 3.6.0 的关键字如下:
False | None | True | |||||
---|---|---|---|---|---|---|---|
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 | while | with | yield |
Python版本为3.6.0 ↩︎