1. 程式人生 > >python中的保留字

python中的保留字

python 中有很多保留字和有特殊含義的單詞,它們不適合作為變數名或函式名或類名

You may not name your variables any of the following words as they mean special things in Python:

and 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

Do NOT use any of the following words either (although they are not strictly Python reserved words, they conflict with the names of commonly-used Python functions):

Data Float Int Numeric Oxphys
array close float int input
open range type write zeros

You should also avoid all the names defined in the math library (you must avoid them if you import the library):

acos asin atan cose
exp fabs floor log log10
pi sin sqrt tan