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. 求帮看!!!!BZOJ 1014 [JSOI2008]火星人prefix

    1014: [JSOI2008]火星人prefix Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 4164  Solved: 1277[Submit] ...

  2. 【动态规划】XMU 1028 Game Boy Advance

    题目链接: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1028 题目大意: 求01背包最优解的方案.物件数和物件编号. 题目思路: [动态规划] ...

  3. 动态规划初级练习(一):ZigZag

    Problem Statement      A sequence of numbers is called a zig-zag sequence if the differences between ...

  4. 下载gtest

    gtest的官网地址:https://github.com/google/googletest 方式一:下载打包好的版本 在github的页面上可以直接下载打包好的gtest,下载入口如下图所示: 方 ...

  5. JS调试工具

    IE http://msdn.microsoft.com/zh-cn/library/ie/dn255003(v=vs.85).aspx FF http://www.wumii.com/item/1g ...

  6. cloudCompute

    云计算使企业可以迅速对市场做出反应而且加强了企业内部的协同 人人都在用云计算的时候能够迅速迁移到云平台已经不叫优势了,反而不使用云计算成为了一种劣势

  7. C#日历上显示节气、阴阳历节假日信息

    近期在做一个工作日历,想在日历上设置工作日,显示请假.加班等相关信息,显示农历日期信息(包括农历日期.节日 .节气).公历信息(节假期). 不能不说,http://www.cnblogs.com/ho ...

  8. UVA11995【I can guess the data structrue!!】【水】+UVA11991【map用法】

    先看UVA11995 两份代码一份直接用C写的,一份用STL写的 #include <iostream> #include <stdio.h> #include <str ...

  9. xml中不能直接添加ViewGroup

    我知道可以直接添加一个<View />的,今天想添加个容器类,然后后台动态添加SurfaceView到ViewGroup容器里,不过提示inflate报错了.难道ViewGroup不能直接 ...

  10. Linux内核-内核线程

    线程分类:内核线程.用户线程(指不需要内核支持而完全建立在用户空间的线程库,这种线程效率高,由于Linux内核没有轻量级进程(线程)的概念,因此不能独立的对用户线程进行调度,而是由一个线程运行库来组织 ...