7. String Services
******************

The modules described in this chapter provide a wide range of string
manipulation operations.

In addition, Python’s built-in string classes support the sequence
type methods described in the Sequence Types — str, unicode, list,
tuple, bytearray, buffer, xrange section, and also the string-specific
methods described in the 字符串的方法 section. To output formatted
strings use template strings or the "%" operator described in the
String Formatting Operations section. Also, see the "re" module for
string functions based on regular expressions.

* 7.1. "string" — 常见的字符串操作

  * 7.1.1. 字符串常量

  * 7.1.2. 自定义字符串格式化

  * 7.1.3. 格式字符串语法

    * 7.1.3.1. 格式规格迷你语言

    * 7.1.3.2. 格式示例

  * 7.1.4. 模板字符串

  * 7.1.5. String functions

  * 7.1.6. Deprecated string functions

* 7.2. "re" — 正则表达式操作

  * 7.2.1. 正则表达式语法

  * 7.2.2. 模块内容

  * 7.2.3. 正则表达式对象 （正则对象）

  * 7.2.4. 匹配对象

  * 7.2.5. Examples

    * 7.2.5.1. Checking For a Pair

    * 7.2.5.2. 模拟 scanf()

    * 7.2.5.3. search() vs. match()

    * 7.2.5.4. 建立一个电话本

    * 7.2.5.5. 文字整理

    * 7.2.5.6. 找到所有副词

    * 7.2.5.7. 找到所有副词和位置

    * 7.2.5.8. 原始字符记法

* 7.3. "struct" — Interpret strings as packed binary data

  * 7.3.1. 函数和异常

  * 7.3.2. 格式字符串

    * 7.3.2.1. 字节顺序，大小和对齐方式

    * 7.3.2.2. 格式字符

    * 7.3.2.3. 示例

  * 7.3.3. 类

* 7.4. "difflib" — 计算差异的辅助工具

  * 7.4.1. SequenceMatcher 对象

  * 7.4.2. SequenceMatcher 的示例

  * 7.4.3. Differ 对象

  * 7.4.4. Differ 示例

  * 7.4.5. difflib 的命令行接口

* 7.5. "StringIO" — Read and write strings as files

* 7.6. "cStringIO" — Faster version of "StringIO"

* 7.7. "textwrap" — 文本自动换行与填充

* 7.8. "codecs" — 编解码器注册和相关基类

  * 7.8.1. 编解码器基类

    * 7.8.1.1. Codec Objects

    * 7.8.1.2. IncrementalEncoder 对象

    * 7.8.1.3. IncrementalDecoder 对象

    * 7.8.1.4. StreamWriter 对象

    * 7.8.1.5. StreamReader 对象

    * 7.8.1.6. StreamReaderWriter 对象

    * 7.8.1.7. StreamRecoder 对象

  * 7.8.2. 编码格式与 Unicode

  * 7.8.3. 标准编码

  * 7.8.4. Python 专属的编码格式

  * 7.8.5. "encodings.idna" — 应用程序中的国际化域名

  * 7.8.6. "encodings.utf_8_sig" — 带BOM签名的UTF-8编解码器

* 7.9. "unicodedata" — Unicode 数据库

* 7.10. "stringprep" — 因特网字符串预备

* 7.11. "fpformat" — Floating point conversions
