python3 module学习之keyword

来源:互联网 发布:js then函数 编辑:程序博客网 时间:2024/06/01 15:28

参考官方教程,keyword.
源码在github,keyword.
keyword是python的关键字包。
This module allows a Python program to determine if a string is a keyword.

import keyworddir(keyword)

这里写图片描述
keyword中的函数有:

keyword.__all__#['iskeyword','kwlist']

keyword.iskeyword(s)

Return true if s is a Python keyword.用来判断字符串s是否为关键字

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.为一个字符串,包含当前的解释器所有的关键字。
这里写图片描述

原创粉丝点击