11.2. Reserved and Keywords in Python¶
The following are reserved and keywords in Python. These words should not be used as the names for user-defined variables, functions, classes, methods or modules. Python’s keywords can be accessed with the following code:
import keyword
print(f'There are {len(keyword.kwlist)} key words')
for keywrd in keyword.kwlist:
print(keywrd)
There are 33 key words
False
None
True
and
as
...
11.2.1. Logical Keywords¶
True
False
not
and
or
is
None
in
11.2.2. Control Flow Key Words¶
if
else
elif
for
while
break
continue
pass
try
except
finally
raise
return
yield
11.2.3. Definition Key Words¶
def
global
nonlocal
class
lambda
with
assert
del
11.2.4. Module Keywords¶
import
from
as