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