Skip to content

Reserved and Key Words in Python

Reserved and Key Words in Python

The following are reserved keywords in Python. Reserved keywords should not be used as names for user-defined functions, classes, methods or modules. The list of 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

assert

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