:mod:`!keyword` --- Testing for Python keywords

فهرست فصل‌ها دانلود آرشیوناشر

Python 3.14 Docs · نسخهٔ 3.14.10 · PSF License

:mod:!keyword --- Testing for Python keywords

:synopsis: Test whether a string is a keyword in Python.

Source code: Lib/keyword.py

--------------

This module allows a Python program to determine if a string is a keyword <keywords> or soft keyword <soft-keywords>.

Return `True if *s* is a Python keyword <keywords>`.

Sequence containing all the keywords <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.

Return `True if *s* is a Python soft keyword <soft-keywords>`.

Sequence containing all the soft keywords <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.