python-标识符(变量命名)
#使用命令查看内置关键词
import keyword
print(keyword.kwlist)
运行后的结果:
['False', 'None', 'True', 'and', 'as', 'assert', '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']
注意:在python中标识符命名的规则是
(1)有数字,字母,下划线组成
(2)数字不能开头
(3)不能使用内置关键词
(4)严格区分大小写