Saturday, March 21, 2015

keyword.kwlist - Python Tutorial

keyword.kwlist


keyword.kwlist will display a list of Python keywords when the keyword module has been imported. If you ever need to know the list of reserved words in the Python Programming Language we can import the keyword module and call keyword.kwlist to display a list of keywords.


keyword.kwlist Example


#keyword.kwlist

>>> import keyword
>>> keyword.kwlist
['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']

#remove keyword module
>>> del keyword

If you have any questions about the keyword module or the keyword.kwlist command leave a message below we will help you out.



No comments:

Post a Comment