Keyword Modules
keyword
Inspect reserved and context-sensitive keyword spellings for the current Python grammar. Useful in code generation and editor tooling, together with str.isidentifier().
Formal Syntax & Structure
python syntaxpython
keywordReturn Value
module
Module object accessed through import.
Working Example
Example Snippetpython
import keywordprint(keyword.iskeyword("for"), keyword.issoftkeyword("case"))