The keyword module (see Example 13-18) contains a list of the keywords used in the current version of Python. It also provides a dictionary with the keywords as keys, and a predicate function that can be used to check if a given word is a Python keyword.
File: keyword-example-1.py import keyword name = raw_input("Enter module name: ") if keyword.iskeyword(name): print name, "is a reserved word." print "heres a complete list of reserved words:" print keyword.kwlist Enter module name: assert assert is a reserved word. heres a complete list of reserved words: [and, assert, reak, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, ot, or, pass, print, aise, eturn, ry, while]