Python 变量命名规则
python 是动态编译语言,不用事先声明类型,赋值即声明。
1. 要具有描述性
2.变量名只能是:数字,字母组成,不可以是空格或特殊字符,如:(#?。,¥$*~!&)等
3.不能是中文
4.不能以数字开头
5.保留字符是不能被使用,如下:
[\'and\', \'as\', \'assert\', \'break\', \'class\', \'continue\', \'def\', \'del\', \'elif\', \'else\', \'except\', \'exec\', \'finally\', \'for\', \'from\', \'global\', \'if\', \'import\', \'in\', \'is\', \'lambda\', \'not\', \'or\', \'pass\', \'print\', \'raise\', \'return\', \'try\', \'while\', \'with\', \'yield\']
6.变量区分大小写
常用的命名方法:
phone_number = 13000000000
phoneNumber = 13000000000