教程集 www.jiaochengji.com
教程集 >  Python编程  >  Python入门  >  正文 Python中的变量命名规则

Python中的变量命名规则

发布时间:2021-12-05   编辑:jiaochengji.com
教程集为您提供Python中的变量命名规则等资源,欢迎您收藏本站,我们将为您提供最新的Python中的变量命名规则资源

Python 变量命名规则

1. 要具有描述性

2.变量名只能是:数字,字母组成,不可以是空格或特殊字符,如:(#?。,¥$*~!&)等

3.不能是中文

4.不能以数字开头

相关推荐:《Python视频教程》

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

您可能感兴趣的文章:
python语言变量命名规则
Python中的变量命名规则
Python基本语法与变量的相关介绍
Python超级详细的变量命名规则
python中变量的命名及详解
详解Python标识符命名规范
PHP变量命名规则详解
python标识符是什么
VBScript 变量
name是python的标识符吗

[关闭]
~ ~