Skip to content

Latest commit

 

History

History
71 lines (60 loc) · 1.04 KB

File metadata and controls

71 lines (60 loc) · 1.04 KB

Python keywords​

{:.no_toc}

* TOC {:toc}

The goal

You need to know the keywords for Python because you should not use them as variable, class, or function names.

Questions to David Rotermund

import keyword

print(keyword.kwlist)
print()
print(keyword.softkwlist) # -> ['_', 'case', 'match']

Output:

['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']
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
_
case
match