标签:final else rom fence tin 保留 python 函数名 区分大小写
python中有一些单词被赋予特殊的意义,这些单词就叫做关键字或保留字,不能用于变量名,函数名,模块名和类名。通过以下代码可以查看python包含的关键字:
import keyword print(keyword.kwlist)
以上代码输出结果为:
[‘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‘]
标签:final else rom fence tin 保留 python 函数名 区分大小写
原文地址:https://www.cnblogs.com/yemeiivan-zhang/p/12455725.html