文本处理服务
************

本章介绍的模块提供了广泛的字符串操作和其他文本处理服务。

在 二进制数据服务 之下描述的 "codecs" 模块也与文本处理高度相关。此外也
请参阅 Python 内置字符串类型的文档 文本序列类型 --- str。

* "string" --- 常见的字符串操作

  * 字符串常量

  * Custom string formatting

  * Format string syntax

    * Format specification mini-language

    * 格式示例

  * 模板字符串 ($-字符串)

  * 辅助函数

* "string.templatelib" --- 对模板字符串字面值的支持

  * 模板字符串

  * 类型

  * 辅助函数

* "re" --- 正则表达式操作

  * 正则表达式语法

  * 模块内容

    * 标志

    * 函数

    * 异常

  * Regular expression objects

  * Match objects

  * Regular expression examples

    * Checking for a pair

    * 模拟 scanf()

    * search() vs. prefixmatch()

    * prefixmatch() vs. match()

    * Making a phonebook

    * Text munging

    * Finding all adverbs

    * Finding all adverbs and their positions

    * Raw string notation

    * Writing a tokenizer

* "difflib" --- 计算差异的辅助工具

  * SequenceMatcher objects

  * SequenceMatcher examples

  * Differ objects

  * Differ example

  * difflib 的命令行接口

  * ndiff 示例

* "textwrap" --- 文本自动换行与填充

* "unicodedata" --- Unicode 数据库

* "stringprep" --- 因特网字符串预处理

* "readline" --- GNU readline 接口

  * 初始化文件

  * 行缓冲区

  * 历史文件

  * 历史列表

  * 启动钩子

  * 补全

  * 示例

* "rlcompleter" --- 用于 GNU readline 的补全函数
