keyword
--- 檢驗Python關(guān)鍵字?
源碼: Lib/keyword.py
This module allows a Python program to determine if a string is a keyword or soft keyword.
- keyword.kwlist?
包含解釋器定義的所有 關(guān)鍵字 的序列。 如果所定義的任何關(guān)鍵字僅在特定
__future__
語句生效時被激活,它們也將被包含在內(nèi)。
- keyword.issoftkeyword(s)?
Return
True
if s is a Python soft keyword.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.3.9 新版功能.