> **Источник:** https://python-all.ru/3.16/library/text.html
>
> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.

---

# Службы обработки текста

Модули, описанные в этой главе, предоставляют широкий набор операций по работе со строками и других служб обработки текста.

Модуль [`codecs`](https://python-all.ru/3.16/library/codecs.html#module-codecs), описанный в разделе [Службы двоичных данных](https://python-all.ru/3.16/library/binary.html#binaryservices), также имеет прямое отношение к обработке текста. Дополнительно см. документацию по встроенному строковому типу Python в [Тип последовательности текста – str](https://python-all.ru/3.16/library/stdtypes.html#textseq).

- [`string` – Общие операции со строками](https://python-all.ru/3.16/library/string.html)

  - [Строковые константы](https://python-all.ru/3.16/library/string.html#string-constants)
  - [Пользовательское форматирование строк](https://python-all.ru/3.16/library/string.html#custom-string-formatting)
  - [Синтаксис форматных строк](https://python-all.ru/3.16/library/string.html#format-string-syntax)

    - [Мини-язык спецификации формата](https://python-all.ru/3.16/library/string.html#format-specification-mini-language)
    - [Примеры форматирования](https://python-all.ru/3.16/library/string.html#format-examples)
  - [Строки-шаблоны ($-strings)](https://python-all.ru/3.16/library/string.html#template-strings-strings)
  - [Вспомогательные функции](https://python-all.ru/3.16/library/string.html#helper-functions)
- [`string.templatelib` – Поддержка шаблонных строковых литералов](https://python-all.ru/3.16/library/string.templatelib.html)

  - [Строки-шаблоны](https://python-all.ru/3.16/library/string.templatelib.html#template-strings)
  - [Типы](https://python-all.ru/3.16/library/string.templatelib.html#types)
  - [Вспомогательные функции](https://python-all.ru/3.16/library/string.templatelib.html#helper-functions)
- [`re` – Операции с регулярными выражениями](https://python-all.ru/3.16/library/re.html)

  - [Синтаксис регулярных выражений](https://python-all.ru/3.16/library/re.html#regular-expression-syntax)
  - [Содержание модуля](https://python-all.ru/3.16/library/re.html#module-contents)

    - [Флаги](https://python-all.ru/3.16/library/re.html#flags)
    - [Функции](https://python-all.ru/3.16/library/re.html#functions)
    - [Исключения](https://python-all.ru/3.16/library/re.html#exceptions)
  - [Объекты регулярных выражений](https://python-all.ru/3.16/library/re.html#regular-expression-objects)
  - [Объекты сопоставления](https://python-all.ru/3.16/library/re.html#match-objects)
  - [Примеры регулярных выражений](https://python-all.ru/3.16/library/re.html#regular-expression-examples)

    - [Проверка наличия пары](https://python-all.ru/3.16/library/re.html#checking-for-a-pair)
    - [Имитация scanf()](https://python-all.ru/3.16/library/re.html#simulating-scanf)
    - [search() и prefixmatch()](https://python-all.ru/3.16/library/re.html#search-vs-prefixmatch)
    - [prefixmatch() и match()](https://python-all.ru/3.16/library/re.html#prefixmatch-vs-match)
    - [Создание телефонной книги](https://python-all.ru/3.16/library/re.html#making-a-phonebook)
    - [Обработка текста](https://python-all.ru/3.16/library/re.html#text-munging)
    - [Поиск всех наречий](https://python-all.ru/3.16/library/re.html#finding-all-adverbs)
    - [Поиск всех наречий и их позиций](https://python-all.ru/3.16/library/re.html#finding-all-adverbs-and-their-positions)
    - [Сырые строки](https://python-all.ru/3.16/library/re.html#raw-string-notation)
    - [Написание токенизатора](https://python-all.ru/3.16/library/re.html#writing-a-tokenizer)
- [`difflib` – Вспомогательные функции для вычисления разностей](https://python-all.ru/3.16/library/difflib.html)

  - [Объекты SequenceMatcher](https://python-all.ru/3.16/library/difflib.html#sequencematcher-objects)
  - [Примеры SequenceMatcher](https://python-all.ru/3.16/library/difflib.html#sequencematcher-examples)
  - [Объекты Differ](https://python-all.ru/3.16/library/difflib.html#differ-objects)
  - [Пример Differ](https://python-all.ru/3.16/library/difflib.html#differ-example)
  - [Интерфейс командной строки для difflib](https://python-all.ru/3.16/library/difflib.html#a-command-line-interface-to-difflib)
  - [Пример ndiff](https://python-all.ru/3.16/library/difflib.html#ndiff-example)
- [`textwrap` – Перенос и заполнение текста](https://python-all.ru/3.16/library/textwrap.html)
- [`unicodedata` – База данных Unicode](https://python-all.ru/3.16/library/unicodedata.html)
- [`stringprep` – Подготовка строк для интернета](https://python-all.ru/3.16/library/stringprep.html)
- [`readline` – Интерфейс GNU readline](https://python-all.ru/3.16/library/readline.html)

  - [Файл инициализации](https://python-all.ru/3.16/library/readline.html#init-file)
  - [Буфер строки](https://python-all.ru/3.16/library/readline.html#line-buffer)
  - [Файл истории](https://python-all.ru/3.16/library/readline.html#history-file)
  - [Список истории](https://python-all.ru/3.16/library/readline.html#history-list)
  - [Перехватчики запуска](https://python-all.ru/3.16/library/readline.html#startup-hooks)
  - [Автодополнение](https://python-all.ru/3.16/library/readline.html#completion)
  - [Пример](https://python-all.ru/3.16/library/readline.html#example)
- [`rlcompleter` – Функция автодополнения для GNU readline](https://python-all.ru/3.16/library/rlcompleter.html)
