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‘]
常用的命名方法:
phone_number = 13000000000
phoneNumber = 13000000000
原文地址:https://www.cnblogs.com/klvchen/p/8446270.html
时间: 2024-11-05 05:27:55