The keyword module in Python's standard library allows a Python program to determine if a string is a keyword.
keyword.iskeyword(s): This function returns true if s is a Python keyword.
keyword.kwlist: This attribute returns Sequence containing all the keywords defined for the interpreter. If any keywords are to be appearing in future versions, these will be included as well.
>>> import keyword
>>> kwlist = keyword.kwlist
>>> kwlist
['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']
>>> kw = input('enter a keyword..')
enter a keyword..catch
>>> kw in kwlist
False
>>> kw = input('enter a keyword..')
enter a keyword..import
>>> kw in kwlist
True