Keyword Attributes

keyword.kwlist

Sequence of reserved keyword spellings for this interpreter. Treat it as read-only reference data; mutating the exposed list is not a supported way to change grammar.

Formal Syntax & Structure

python syntaxpython
keyword.kwlist

Return Value

list[str]

The list[str] result described above.

Working Example

Example Snippetpython
import keywordprint("class" in keyword.kwlist, "match" in keyword.kwlist)
Python Reference