python有多少種模塊_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...) 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).

(?

(?(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環境下(待續……)

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/455592.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/455592.shtml
英文地址,請注明出處:http://en.pswp.cn/news/455592.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

淺談面向對象的javascript幾個特性

javascript中的this和new javascript是一門很靈活的語言&#xff0c;尤其是function。他即可以以面向過程的方式來用&#xff0c;比如&#xff1a; function getName() {return 張三 } getName() 也可以以面向對象的方式來用&#xff0c;比如&#xff1a; function User() {th…

【Netty】ChannelHandler和ChannelPipeline

一、前言 前面學習了Netty的ByteBuf&#xff0c;接著學習ChannelHandler和ChannelPipeline。 二、ChannelHandler和ChannelPipeline 2.1 ChannelHandler 在ChannelPipeline中&#xff0c;ChannelHandler可以被鏈在一起處理用戶邏輯。 1. Channel生命周期 Channel接口定義了一個…

TS流頭部的調整字段

見 http://hi.baidu.com/xumingxsh/blog/item/7b178903f1fa98014afb512f.html http://hi.baidu.com/xumingxsh/blog/item/ba50dba320a10da3caefd02f.html

electron 入坑記

最近有個想法,想寫個簡單的應用程序.平時在 Mac上開發,最終有可能運行在 Windows 上.看了一下,Electron 比較簡單,應該可以一試. 關于安裝 我機器上是有 Node 環境的,按著官方教程 直接 npm install electron 結果運行到 npm install.js就不到了..下午上班有事,也沒管他,結果一…

自動駕駛安全駕駛規則_自動駕駛知識科普 自動駕駛汽車的七大核心技術

自動駕駛技術的本質是用機器視角去模擬人類駕駛員的行為&#xff0c;其技術框架可以分為三個環節&#xff1a;感知層、決策層 和執行層&#xff0c;具體涉及傳感器、計算平臺、算法、高精度地圖、OS、HMI等 多個技術模塊。目前自動駕駛L3商業化技術已經成熟&#xff0c;L4級/L5…

orcal數據操作

1.將數據庫ZHSY完全導出,用戶名baseusernj密碼baseusernj導出到D:\daochu.dmp中 exp baseusernj/baseusernjZHSY filed:\daochu.dmp fully exp baseuserhf/baseuserhfZJCPDB fileC:\105hf.dmp ownerbaseuserhf 2.導入那個數據庫的用戶就寫那個&#xff0c;第一個是用戶名&#…

H264實時編碼及NALU,RTP傳輸(ZZ)

rfc3984 Standards Track [Page 2] RFC 3984 RTP Payload Format for H.264 Video February 2005 1. 按照RFC3984協議實現H264視頻流媒體nalu單元 包起始 0x 00 00 00 01H&#xff0e;264 NAL格式及分析器http://hi.baidu.com/zsw%5Fdavy/b ... c409cc7cd92ace.htmlhttp://hi.b…

學習具體計劃書

計劃書10大行動&#xff1a;1. 學習的時候不玩手機學習的時候把手機放在抽屜里&#xff0c;靜音2. 及時復習學完一個章節的知識及時復習覺得有做分享的價值就做分享錄視頻3. 不學習的時間要好好利用花時間做好吃的&#xff0c;把身體弄好多看看心理學的書&#xff0c;<接觸青…

初識python

課程介紹: python語言:python語言是一種計算機程序設計語言,實現人機交互的語言 python的課程設計python基礎 (python開發工程師)數據庫和SQL開發 (數據分析工程師)網絡爬蟲 (網絡爬蟲工程師)高數和數據分析 (數據分析工程師)人工智能和機器學習 …

photoshop最全快捷鍵列表

一、工具箱(多種工具共用一個快捷鍵的可同時按【Shift】加此快捷鍵選取) 矩形、橢圓選框工具 【M】 移動工具 【V】 套索、多邊形套索、磁性套索 【L】 魔棒工具 【W】 裁剪工具 【C】 切片工具、切片選擇工具 【K】 噴槍工具 【J】 畫筆工具、鉛筆工具 【B】 像皮圖章、圖案圖…

python實例化對象做實參_如何在Python中記住類實例化?

好的&#xff0c;這是真實的場景&#xff1a;我正在編寫一個應用程序&#xff0c;我有一個類&#xff0c;它表示某種類型的文件&#xff08;在我的例子中&#xff0c;這是照片&#xff0c;但細節與問題無關&#xff09;。照片類的每個實例對于照片的文件名都應該是唯一的。 問題…

bupt summer training for 16 #3 ——構造

https://vjudge.net/contest/172464 后來補題發現這場做的可真他媽傻逼 A.簽到傻逼題&#xff0c;自己分情況 1 #include <cstdio>2 #include <vector>3 #include <algorithm>4 5 using std::vector;6 using std::sort;7 8 typedef long long ll;9 10 int n…

Python02期(北京)課程筆記索引

day01 初始python關于使用notepad運行python程序注釋和語句分類 day02 命名方式和關鍵字數據類型數據類型轉換 day03 變量與數據類型運算和運算符進制轉換 day04 循環結構 day05 函數概述 day06 nonlocal和global 關鍵字詳解 day07 python核心,內建函數高階函數字…

python常用快捷鍵、寫代碼事半功倍_Pycharm常用快捷鍵總結及配置方法

工欲善其事必先利其器&#xff0c;Python開發利器Pycharm常用快捷鍵以及配置如下&#xff0c;相信有了這些快捷鍵&#xff0c;你的開發會事半功倍 一 常用快捷鍵 編輯類&#xff1a; Ctrl D 復制選定的區域或行 Ctrl Y 刪除選定的行 Ctrl Alt L 代碼格式化 Ctrl Alt O 優…

PHP中的魔術常量

魔術常量 PHP 向它運行的任何腳本提供了大量的預定義常量。不過很多常量都是由不同的擴展庫定義的&#xff0c;只有在加載了這些擴展庫時才會出現&#xff0c;或者動態加載后&#xff0c;或者在編譯時已經包括進去了。 有八個魔術常量它們的值隨著它們在代碼中的位置改變而改…

Java中的繼承性特性

繼承性是java中的第二特性之一。而繼承性最為關鍵的地方為&#xff1a;代碼重用性的問題&#xff0c;利用繼承性可以從已有的類中繼續派生出新的子類&#xff0c;也可以利用子類擴展出更多的操作功能。 繼承性的實現代碼為&#xff1a;class 子類 extends 父類{ } 有以下3點說…

10大html5前端框架

Bootstrap 首先說 Bootstrap&#xff0c;估計你也猜到會先說或者一定會有這個( 呵呵了 )&#xff0c;這是說明它的強大之處&#xff0c;擁有框架一壁江山的勢氣。自己剛入道的時候本著代碼任何一個字母都得自己敲出來擋我者廢的決心&#xff0c;來讓自己成長。結果受到周圍各 種…

多媒體技術復習匯總 收藏

多媒體技術復習匯總 收藏 1. 什么是媒體&#xff1a;媒體是信息表示和傳輸的載體。2. 媒體分類&#xff1a;感覺媒體&#xff0c;表示媒體&#xff0c;表現媒體&#xff0c;存儲媒體&#xff0c;傳輸媒體3. 多媒體技術的定義和特點&#xff1a;多媒體技…

PHP中的語法特點小結

PHP中的語法特點小結 1.PHP的變量開頭要加上$符號,見到$就知道這個是一個變量 2.PHP中的常量才是不用加$符號的 3.PHP中$可以用來嵌套使用,從而實現動態的變量名的層級調用 4.PHP程序<?php開頭,結尾可以加上?>,也可以不加 5.PHP中的常量有著魔術常量(系統自帶的) 6.PH…