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
字符串格式化操作
section. Also, see the
re
module for string functions based on regular expressions.
string
— 常见字符串操作
re
— 正则表达式运算
struct
— 把字符串解释为打包二进制数据
difflib
— 增量计算帮手
StringIO
— 按文件方式读写字符串
cStringIO
— 更快版本的
StringIO
textwrap
— 文字换行和填充
codecs
— 编解码器注册和基类
unicodedata
— Unicode 数据库
stringprep
— 互联网字符串预备
fpformat
— 浮点转换