在变量命名时,python中有33个保留字是我们不能使用的。
import keyword
for kw in keyword.kwlist:
print(kw)
输出:
False
None
True
and
as
assert
async
await
break
class
continue
def
del
elif
else
except
finally
for
from
global
if
import
in
is
lambda
nonlocal
not
or
pass
raise
return
try
while
with
yield