- 所有命名规范都要准守这三条
1.命名只能以字母或者_下划线开头
#错误类名
class 4_Person():
pass
#错误函数名
def 漂亮():
pass
2.名字不能包含空格
3.名字不能与关键字重合
#错误函数名,与关键字and重合
def and():
pass
关键字参考《如何写一个函数》
- 不能将字符l(小写字母l),'O''o'(大小写字母o)、'I'(大写字母I)用作变量名称,防止和数字0、1混淆
模块 module_name
- 与包的规范相同,如mymodule
import decoder
import html_parser
#不推荐的这种命名
import Decoder
包 package_name
- 应该是简短的、小写的名