Text of docs.python.org › pa › 3 › library › keyword.html as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

keyword --- Testing for Python keywords — Python 3.15.2 documentation

Navigation index modules | next | previous | Python » 3.15.2 documentation » The Python standard library » Python Language Services » keyword --- Testing for Python keywords | Theme | keyword --- Testing for Python keywords ¶ Source code: Lib/keyword.py This module allows a Python program to determine if a string is a keyword or soft keyword . keyword. iskeyword ( s ) ¶ Return True if s is a Python keyword . keyword. kwlist ¶ Sequence containing all the keywords defined for the interpreter.

If any keywords are defined to only be active when particular __future__ statements are in effect, these will be included as well. keyword. issoftkeyword ( s ) ¶ Return True if s is a Python soft keyword . Added in version 3.9. keyword. softkwlist ¶ Sequence containing all the soft keywords defined for the interpreter. If any soft keywords are defined to only be active when particular __future__ statements are in effect, these will be included as well.

Added in version 3.9. Previous topic token --- Constants used with Python parse trees Next topic tokenize --- Tokenizer for Python source This page Report a bug Improve this page Show source Show translation source « Navigation index modules | next | previous | Python » 3.15.2 documentation » The Python standard library » Python Language Services » keyword --- Testing for Python keywords | Theme | © Copyright 2001 Python Software Foundation.

This page is licensed under the Python Software Foundation License Version 2. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License. See History and License for more information. The Python Software Foundation is a non-profit corporation. Please donate. Last updated on ਨਵੰ 19, 2026 (09:42 UTC). Found a bug ? Created using Sphinx 9.1.1.