Python的关键字是Python语言中预定义的保留字,它们用于定义语法结构,控制程序流程,实现循环等功能。以下是Python的33个关键字列表:
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
这些关键字用于控制流(如if语句、循环等)、函数定义、类定义等主要编程概念。
import keyword
print(keyword.kwlist)