`!keyword` --- Testing for Python keywords
keyword
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>.
iskeyword(s)
Return True if s is a Python keyword <keywords>.
kwlist
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.
issoftkeyword(s)
Return True if s is a Python soft keyword <soft-keywords>.
3.9
softkwlist
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.
3.9
这篇文档对你有帮助吗?
谢谢你的反馈!