[Python standard library] Chapter 1 Text

Source: Internet
Author: User

Chapter01 text 1.1 string-text constants and templates

Function: contains constants and classes for processing text.
1.1.1 Functions

Maketrans () 
Translate () ': modifies a group of characters to another group of characters. 

1.1.2 Template
Use string. during Template splicing, you can add the prefix $ (for example, $ var) before the variable to mark the variable, alternatively, you can use braces to enclose variables (for example, $ {var}) to distinguish them from the texts on both sides }).
You can use the saft_substitute () method to avoid exceptions when you fail to provide all the parameters required by the template.

1.1.3 modify the default syntax of the string. Template in the advanced Template to adjust the regular expression used by the variable name in the Template weight search. 1. Modify delimiter and idpattern attributes. 2. overwrite the pattern attribute and define a new regular expression.

1.2 textwrap-format text paragraphs

Purpose: format the text by adjusting the position where the line break appears in the paragraph.
1.2.1 Functions

Dedent () 
Indent () ': indent 

1.3 re-Regular Expression

Purpose: use the formal mode to search for and modify texts.
1.3.1 Functions

Compile () 
Findall () 
Finditer () ': returns an iterator. 

1.3.2 escape code
1.3.3 anchoring
1.3.4 abbreviations

1.4 difflib-comparison Sequence

Role: Comparison Sequence

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.