国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python的keyword模塊用法實例分析

2019-11-25 17:14:40
字體:
來源:轉載
供稿:網(wǎng)友

本文實例講述了python的keyword模塊用法。分享給大家供大家參考。具體如下:

Help on module keyword:NAME  keyword - Keywords (from "graminit.c")FILE  /usr/lib64/python2.6/keyword.pyDESCRIPTION  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.pyFUNCTIONS  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程序設計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 通许县| 九台市| 定襄县| 黔南| 什邡市| 工布江达县| 申扎县| 衡东县| 武冈市| 临武县| 舒兰市| 岳阳县| 阜城县| 东乡县| 中西区| 浮梁县| 尉氏县| 石林| 台江县| 吕梁市| 资源县| 象州县| 三亚市| 高雄县| 湖州市| 咸阳市| 营口市| 昆山市| 陕西省| 安溪县| 安宁市| 桃园县| 新竹市| 杨浦区| 荣成市| 庄河市| 陆良县| 锡林浩特市| 阿鲁科尔沁旗| 锦屏县| 贡觉县|