Python Learning section 15th (Regular)

Source: Internet
Author: User

A regular greedy match

Non-greedy mode is based on the minimum number of repetitions

Non-greedy match

The regular method

Re.split Regular Segmentation

Number of Splits

Keep delimiters, enclose delimiters with one parenthesis

Sub substitution string
Requires three parameters, content to replace (regular), new content, string

Write separately with compile
Can write a rule once
Then multiple matches, the advantage is convenient and flexible.

Returns an Iterator object

Crawler crawling watercress Movie information, with regular

Module Configparser
Function: Create the following types of files

How to use

Read operation

Default is the default information and does not need to be printed, which is the shared information for all paragraph information.

Use the method to determine whether a field is within a file

If the value is taken, the contents of the file are taken out, the dictionary keys in the dictionary

Subprocess Module
When called, the freshmen become a process.

Linux environments do not need to add shell=true unless the command is a combination command

Python Learning section 15th (Regular)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.