Showing posts with label reserved words. Show all posts
Showing posts with label reserved words. Show all posts

Wednesday, July 1, 2009

How to list out Python reserved words

To list out the Python reserved words, just enter the following lines into the Python interpreter.
>>> import keyword
>>> print(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']
Python Reserved Words