Python中有多少个关键字?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
成都创新互联公司专注于保山企业网站建设,成都响应式网站建设公司,商城网站开发。保山网站建设公司,为保山等地区提供建站服务。全流程按需搭建网站,专业设计,全程项目跟踪,成都创新互联公司专业和态度为您提供的服务
Python中关键词目前有31个,可以利用Python的内置的keyword模块进行输出查看。
keyword模块
Help on module keyword: NAME keyword - Keywords (from "graminit.c") FILE /usr/lib64/python2.6/keyword.py DESCRIPTION This file is automatically generated; please don't muck it up! To update the symbols in this file, 'cd' to the top directory of the python source tree after building the interpreter and run: python Lib/keyword.py FUNCTIONS iskeyword = __contains__(...) x.__contains__(y) y in x. DATA __all__ = ['iskeyword', 'kwlist'] kwlist = ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', ...
得到python的关键字列表:
>>> keyword.kwlist ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']
判断字符串是否是python的关键字
>>> keyword.iskeyword('and') True >>> >>> keyword.iskeyword('has') False
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。
当前名称:Python中有多少个关键字
文章源于:https://www.cdcxhl.com/article38/pdodsp.html
成都网站建设公司_创新互联,为您提供品牌网站设计、面包屑导航、网站排名、移动网站建设、微信小程序、Google
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联