python中的变量命名要求 --Python3

知识共享许可协议 版权声明:署名,允许他人基于本文进行创作,且必须基于与原先许可协议相同的许可协议分发本文 (Creative Commons

1、变量名只能包含:字母、数字和下划线
2、变量不能以数字开头
3、不能是python中的关键字

python中的关键字:and、as、asset、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

4、变量命名的一个建议:见名知意;用下划线连接(不建议使用驼峰式命名)

猜你喜欢

转载自blog.csdn.net/Thanlon/article/details/94716950