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查看模块及相关函数帮助的更多相关文章

  1. Python 查看模块的帮助文档,方法和帮助信息

    参考链接:https://blog.csdn.net/u013810296/article/details/55509284 这里介绍下python自带的查看帮助功能,可以在编程时不中断地迅速找到所需 ...

  2. Python查看模块函数,查看函数方法的详细信息

    Python查看方法的详情 1.通用的帮助函数help() 使用help()函数来查看函数的帮助信息. 如: import requests help(requests) 会有类似如下输出: 2.查询 ...

  3. Python查看模块

    1.查看Python所有内置模块 按以下链接打开,每个模块有介绍,可以选择不同的版本 https://docs.python.org/3.6/library/index.html 2.查看Python ...

  4. python 查看模块中的方法

    way 1.help() way 2.dir() # dir() 函数不带参数时,返回当前范围内的变量.方法和定义的类型列表: way 3. 使用inspect模块, inspect.getmembe ...

  5. python 查看模块的存放位置

    执行 dlib.__file__ 输出 '/anaconda2/lib/python2.7/site-packages/dlib/__init__.pyc'

  6. python查看模块版本及所在文件夹

    # 以Numpy为例 第一种方法:import numpy as np np.__version__ >>> '1.12.1' np.__file__ >>> '/ ...

  7. 查看python内部模块命令,内置函数,查看python已经安装的模块命令

    查看python内部模块命令,内置函数,查看python已经安装的模块命令 可以用dir(modules) 或者用 pip list或者用 help('modules') 或者用 python -m  ...

  8. 查看python中模块的所有方法

    查看python中模块的所有方法     安装的python模块,现将查看方法总结如下 一.CMD命令行下使用pydoc命令 在命令行下运行$ pydoc modules即可查看 二.在python交 ...

  9. Python:日期和时间的处理模块及相关函数

    Python:日期和时间的处理模块及相关函数 Python 提供 time 模块和 calendar 模块用于格式化日期和时间. 一.时间戳 在Python中,时间戳是以秒为单位的浮点小数,它是指格林 ...

随机推荐

  1. HDOJ 2072 单词数

    Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数.下面你的任务是帮助xiaoou333解决这个问题. ...

  2. 构建你的第一个App

    Building Your First App 原文链接:http://developer.android.com/training/basics/firstapp/index.html 译文链接1: ...

  3. PCRE

    http://blog.sina.com.cn/s/blog_6a1837e901010ckv.html http://hubeihuyanwei.blog.163.com/blog/static/2 ...

  4. HDU_1429——胜利大逃亡续,十位二进制状态压缩,状态判重

    Problem Description Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)……这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁 ...

  5. 关于group by【转载】

    1.概述 “Group By”从字面意义上理解就是根据“By”指定的规则对数据进行分组,所谓的分组就是将一个“数据集”划分成若干个“小区域”,然后针对若干个“小区域”进行数据处理. 2.原始表 3.G ...

  6. HDU 3853 LOOPS

    题意:对于每一格,都可以往右走,原地不走,往下走,概率分别为a[i],b[i],c[i](每一个格子与其他格子的概率不一定相同).在R*C的棋盘上(输入数据保证不会走出棋盘),求从(0, 0)走到(R ...

  7. SRM 584 DIV1

    A 简单的差分约束模型 , 因为d是定值 , 所以也可以按最短路理解 , trick是不能把圈算进去. #define maxn 55 class Egalitarianism { public: i ...

  8. libvirt hypervisors信息采集

    libvirt采集hypervisors信息的通用格式 driver[+transport]://[username@][hostname][:port]/[path][?extraparameter ...

  9. Selenium webdriver 高级应用

    对于这一段还蛮有感慨的,只想说,代码还是需要自己去敲的. 1. 改变用户代理 import org.junit.AfterClass; import org.junit.BeforeClass; im ...

  10. UINavigationController 导航控制器 ,根据文档写的一些东西

    今天讲了导航控制器UINavigationController 和标签栏视图控制器UITabBarController 先来说一说导航视图控制器  UINavigationController 导航控 ...