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’]

查看方法

导入
import keyword
然后回车输入
keyword.kwlist
再回车

在python.exe中
在这里插入图片描述
在PyCharm中要加print
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_43228135/article/details/86749046