标签:nbsp stat raw rate ble cfile enumerate eth 变量命名
Python中关键字
关键字都有特殊含义,如果用作变量名,将引发错误:
Flase class finally is return None continue for lambda try True
def from nonlical while and del global not with as elif if or
yield assert else import pass break except in raise
Python内置函数
使用函数名作为变量,虽然不会导致错误,但是会覆盖这些函数的行为:
abs() divmod() input() open() staticmethod()
all() enumerate() int() ord() str()
any() eval() isinstance() pow() sum()
basestring() execfile() issubclass() print() super()
bin() file() iter() property() tuple()
bool() filter() len() range() type()
bytearray() float() list() raw_input() unichr()
callable() format() locals() reduce() unicode()
chr() frozenset() long() reload() vard()
classmethod() getattr() map() repr() xrange()
cmp() globals() max() reversed() zip()
compile() hasattr() memoryview() round() _import_()
complex() hash() min() set() apply()
delattr() help() next() setattr() buffer()
dict() hex() object() slice() coerce()
dir() id() oct() sorted() intern()
在2.7中print不是函数是关键字,python3中没有内置函数Unicode。
变量命名:
1.变量名应既简单又具有描述性。如:name比n好;
2.慎用小写字母l和大写字母O,容易看成数字的1和0。
标签:nbsp stat raw rate ble cfile enumerate eth 变量命名
原文地址:http://www.cnblogs.com/yuruhao/p/6431994.html