|
发表于 2021-4-23 21:43:30
|
显示全部楼层
就是 变量或对象 的名字——标识符——标记出来,使之可以识别出。
人类社会可以都叫 张三,可以有同名同姓的;
可计算机不行,计算机能处理的 必须是 唯一的、确定的 0或1 数字。
其次,不同的编程语言都对 变量的命名有一定的规范(大同小异),
如“保留字”不能用来作变量名,如 不能以数字开头等等。
python中的保留字清单:
- 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']
复制代码
|
|