import keyword
print(keyword.kwlist) #打印出python中所有的关键字
python中所有的关键字
[‘False’, ‘None’, ‘True’, ‘and’, ‘as’, ‘assert’,
‘async’, ‘await’, ‘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’]