# Text Processing Services

The modules described in this chapter provide a wide range of string manipulation operations and other text processing services.

The `codecs` module described under Binary Data Services is also highly relevant to text processing. In addition, see the documentation for Python's built-in string type in Text Sequence Type --- str.

- `string` --- 常见的字符串操作
  - 字符串常量
  - Custom String Formatting
  - Format String Syntax
    - Format Specification Mini-Language
    - Format examples
  - Template strings
  - Helper functions
- `re` — 正则表达式操作
  - 正则表达式语法
  - 模块内容
  - 正则表达式对象 （正则对象）
  - 匹配对象
  - 正则表达式例子
    - 检查对子
    - 模拟 scanf()
    - search() vs. match()
    - 建立一个电话本
    - 文字整理
    - 找到所有副词
    - 找到所有副词和位置
    - 原始字符记法
    - 写一个词法分析器
- `difflib` --- Helpers for computing deltas
  - SequenceMatcher Objects
  - SequenceMatcher Examples
  - Differ Objects
  - Differ Example
  - A command-line interface to difflib
- `textwrap` --- Text wrapping and filling
- `unicodedata` --- Unicode Database
- `stringprep` --- Internet String Preparation
- `readline` --- GNU readline interface
  - Init file
  - Line buffer
  - History file
  - History list
  - Startup hooks
  - Completion
  - 示例
- `rlcompleter` --- Completion function for GNU readline
  - Completer Objects