python如何查看有哪些模块
Question:
如何查看正则表达式模块re及其相关函数的意义
1、终端命令行下
python
>> import sys
>> sys.modules
###################################
一长串信息中字段modules对应的模块即为包含的模块。
###################################
>> import re
>> help(re)
Help on module re: NAME
re - Support for regular expressions (RE). FILE
/usr/lib64/python2.7/re.py DESCRIPTION
This module provides regular expression matching operations similar to
those found in Perl. It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range. Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves. You can
concatenate ordinary characters, so last matches the string 'last'. The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the newline at
the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding RE.
Greedy means that it will match as many repetitions as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
"\\" Either escapes special characters or signals a special sequence.
[] Indicates a set of characters.
A "^" as the first character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses.
The contents can be retrieved or matched later in the string.
(?iLmsux) Set the I, L, M, S, U, or X flag for the RE (see below).
(?:...) Non-grouping version of regular parentheses.
(?P<name>...) The substring matched by the group is accessible by name.
(?P=name) Matches the text matched earlier by the group named name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ... (must be fixed length).
(?<!...) Matches if not preceded by ... (must be fixed length).
(?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
the (optional) no pattern otherwise.
>>> help(re.compile)
Help on function compile in module re: compile(pattern, flags=0)
Compile a regular expression pattern, returning a pattern object.
(END)
2、IDE环境下(待续……)
python如何查看有哪些模块的更多相关文章
- Linux下查看Python安装了哪些脚本模块
Linux下查看Python安装了哪些脚本模块 1.什么是rpm ? rpm 即RedHat Package Management,是RedHat的发明之一 .现在包括OpenLinux.fedora ...
- Python导入自定义包或模块
一般我们会将自己写的 Python 模块与 Python 自带的模块分开存放以达到便于维护的目的. Python 运行环境在查找模块时是对 sys.path 列表进行遍历,如果我们想在运行环境中添加自 ...
- python数据库操作之pymysql模块和sqlalchemy模块(项目必备)
pymysql pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同. 1.下载安装 pip3 install pymysql 2.操作数据库 (1).执行sql #! ...
- python运维开发(六)----模块续
内容目录 反射 模块 os模块 sys模块 md5加密模块 re正则匹配模块 configparse模块 xml模块 shutil模块 subprocess模块 反射 利用字符串的形式去对象(模块)中 ...
- python运维开发(五)----模块、生成器
内容目录 双层装饰器 字符串格式化 生成器和迭代器 递归 模块 双层装饰器 需求场景介绍: 现有用户登录系统,普通用户能查看自己相关信息的权限,管理员用户能查看所有用户的权限,可以做两个装饰器来实现需 ...
- Python 2.7 学习笔记 模块和包
我们来考虑下如下几种场景: 1.编写一个python程序,如果程序比较简单,则可以把代码放到一个python文件中.但如果程序功能比较多,可能需要多个python文件来组织源代码.而这些文件之间的代码 ...
- Python第五章__模块介绍,常用内置模块
Python第五章__模块介绍,常用内置模块 欢迎加入Linux_Python学习群 群号:478616847 目录: 模块与导入介绍 包的介绍 time &datetime模块 rando ...
- Python Docker 查看私有仓库镜像【转】
文章来源:python Docker 查看私有仓库镜像 pip 安装: # 首先安装epel扩展源: yum -y install epel-release # 更新完成之后,就可安装pip: yum ...
- Python 在cmd中import模块成功,但是在jupyter notebook中No module xxx found
由于需要用到python中的某个库,因此打开命令行窗口cmd,然后使用pip安装.安装成功后,在cmd中输入python调出python环境,import该模块并使用,可以正常使用.但是打开juypt ...
随机推荐
- Solr Facet 搜索时,facet.missing = true 的真正含义
Solr的WiKI原文是如下解释: facet.missing Set to "true" this param indicates that in addition to the ...
- Python - Django - 使用 Pycharm 连接 MySQL 数据库
在 Pycharm 的右上方找到 Database 点击 依次点击,选择 MySQL 数据库 点击 Download 下载驱动文件 下载完成后对数据库的相关信息进行填写 填写完成后点击“Test Co ...
- HTML|CSS之前端入门
知识内容: 1.计算机网络综述 2.web基础 3.HTML与CSS介绍 4.JavaScript与jQuery介绍 一.计算机网络综述 1.什么是计算机网络 计算机网络是指将地理位置不同.具有独立功 ...
- aix-syslog
收集网络内路由器的日志信息,同时把本地日志信息与路由器信息分开. /etc/syslog.conf我写成: ## 本地日志处理 *.notice;*.err;*.warn<tab>;< ...
- OpenACC 云水参数化方案
▶ 书上第十三章,用一系列步骤优化一个云水参数化方案.用于熟悉 Fortran 以及 OpenACC 在旗下的表现 ● 代码,文件较多,放在一起了 ! main.f90 PROGRAM main US ...
- WPF 颜色拾色器
效果图: 下载:Code 参考: http://www.codeproject.com/Articles/33001/WPF-A-Simple-Color-Picker-With-Previewhtt ...
- 用Redis实现分布式锁 与 实现任务队列【转载】
这一次总结和分享用Redis实现分布式锁 与 实现任务队列 这两大强大的功能.先扯点个人观点,之前我看了一篇博文说博客园的文章大部分都是分享代码,博文里强调说分享思路比分享代码更重要(貌似大概是这个意 ...
- 可视化库-seaborn-布局风格设置(第五天)
1. sns.set_style() 进行风格设置, sns.set() 进行设置的重置, 五种风格 # 1.darkgrid# 2.whitegrid# 3.dark# 4.white# 5 tic ...
- UI5-文档-4.22-Expression Binding
有时预定义的SAPUI5类型不够灵活,您希望在视图中执行简单的计算或格式化——这正是表达式真正有用的地方.我们使用它们根据数据模型中的当前数字格式化价格. Preview The price is n ...
- vue深入了解组件——Prop
一.Prop的大小写(camelCase vs kebab-case) HTML中的特性名是大小写不敏感的,所以浏览器会把所有大写字符解释为小写字符.这意味着当你使用DOM中的模板时,cameCase ...