虽然以前已经学了2个月python,但仍然感受学的很乱,没有系统性;或者说自学的没有条例,只是追求进度,没有保证知识点的全面与准确。python
从今天开始,从python的基础变量开始从新整理知识点,梳理忽略的内容。愿所学即所会,所会即能用。编程
一、变量名遵循的规则app
二、变量名错误常见错误提示:函数
转引《python:从入门到实践》中的附录code
Python关键字和内置函数orm
4 Python关键字和内置函数 Python包含一系列关键字和内置函数,给变量命名时,知道这些关键字和内置函数很重要。编程中面临的一个挑战是给变量指定合适的名称,变量名能够是任何东西,只要它长短 合适并描述了变量的做用。同时,不能将Python关键字用做变量名;也不该将Python内置函数的名称用做变量名,不然将覆盖相应的内置函数。 本节将列出Python关键字和内置函数的名称,让你知道应避免使用哪些变量名。ip
4.1 Python关键字 下面的关键字都有特殊含义,若是你将它们用做变量名,将引起错误:unicode
False | class | finally | is | return |
None | continue | for | lambda | try |
True | def | from | nonlocal | while |
and | del | global | not | with |
as | elif | if | or | yield |
assert | else | import | pass | |
break | expect | in | raise |
4.2 Python内置函数 将内置函数名用做变量名时,不会致使错误,但将覆盖这些函数的行为:get
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() |
bytearray() | filter() | len() | range() | type() |
callable() | float() | list() | raw_input() | unichr() |
chr() | format() | locals() | reduce() | unicode() |
classmethod() | frozenset | long() | reload() | vars() |
cmp() | getattr() | map() | repr() | xrange() |
compile() | globals() | max() | reversed()zip() | Zip() |
complex() | hasattr() | next() | round() | _import_() |
delattr() | hash() | object() | set() | apply() |
dict() | help() | memoryview() | setattr() | buffer() |
dir() | hex() | min() | slice() | coerce() |
bool() | id() | oct() | sorted() | intern() |