Skip to content

Reserved and Keywords in Python

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
...

Logical Keywords

True
False
not
and
or
is
None
in

Control Flow Key Words

if
else
elif
for
while
break
continue
pass
try
except
finally
raise
return
yield

Definition Key Words

def
global
nonlocal
class
lambda
with
assert
del

Module Keywords

import
from
as