• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > python的keyword模块用法实例分析

python的keyword模块用法实例分析

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了python keyword,keyword是什么意思,keyword,keyword tool,keyword tracker等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

本文实例讲述了python的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', ...

</div>

得到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']

</div>

判断字符串是否是python的关键字

>>> keyword.iskeyword('and')
True
>>> 
>>> keyword.iskeyword('has')
False

</div>

希望本文所述对大家的Python程序设计有所帮助。

</div>

您可能想查找下面的文章:

  • python的keyword模块用法实例分析

相关文章

  • python 简易计算器程序,代码就几行
  • Python中最常用的操作列表的几种方法归纳
  • Python实现的百度站长自动URL提交小工具
  • python函数返回多个值的示例方法
  • 在Django中创建动态视图的教程
  • python使用正则表达式提取网页URL的方法
  • 基于Python 的进程管理工具supervisor使用指南
  • python模拟登录百度贴吧(百度贴吧登录)实例
  • Scrapy-redis爬虫分布式爬取的分析和实现
  • Python松散正则表达式用法分析

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Python常用正则表达式符号浅析
    • python 时间戳与格式化时间的转化实现代码
    • 使用py2exe在Windows下将Python程序转为exe文件
    • 详解在Python中处理异常的教程
    • Python基于pillow判断图片完整性的方法
    • python正则分组的应用
    • python爬虫的工作原理
    • python追加元素到列表的方法
    • Python实现过滤单个Android程序日志脚本分享
    • python实现计算倒数的方法

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有