1、查看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']
2、标识符
标识符就是变量、函数名、类、模板、对象名
规则:字母、数字、下划线、不能数字开头、不能是关键字、严格区分带小写