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

---

# 7. Службы двоичных данных

Модули, описанные в этой главе, предоставляют некоторые базовые сервисные операции для работы с двоичными данными. Другие операции с двоичными данными, особенно связанные с файловыми форматами и сетевыми протоколами, описаны в соответствующих разделах.

Некоторые библиотеки, описанные в разделе [*Службы обработки текста*](https://python-all.ru/3.3/library/text.html#textservices), также работают либо с ASCII-совместимыми двоичными форматами (например, [`re`](https://python-all.ru/3.3/library/re.html#module-re)), либо со всеми двоичными данными (например, [`difflib`](https://python-all.ru/3.3/library/difflib.html#module-difflib)).

Кроме того, смотрите документацию по встроенным двоичным типам данных Python в [*Двоичные типы последовательностей – bytes, bytearray, memoryview*](https://python-all.ru/3.3/library/stdtypes.html#binaryseq).

- [7.1. `struct` – Интерпретация байтов как упакованных двоичных данных](https://python-all.ru/3.3/library/struct.html)

  - [7.1.1. Функции и исключения](https://python-all.ru/3.3/library/struct.html#functions-and-exceptions)
  - [7.1.2. Строки формата](https://python-all.ru/3.3/library/struct.html#format-strings)

    - [7.1.2.1. Порядок байтов, размер и выравнивание](https://python-all.ru/3.3/library/struct.html#byte-order-size-and-alignment)
    - [7.1.2.2. Символы формата](https://python-all.ru/3.3/library/struct.html#format-characters)
    - [7.1.2.3. Примеры](https://python-all.ru/3.3/library/struct.html#examples)
  - [7.1.3. Классы](https://python-all.ru/3.3/library/struct.html#classes)
- [7.2. `codecs` – Реестр кодеков и базовые классы](https://python-all.ru/3.3/library/codecs.html)

  - [7.2.1. Базовые классы кодеков](https://python-all.ru/3.3/library/codecs.html#codec-base-classes)

    - [7.2.1.1. Объекты кодеков](https://python-all.ru/3.3/library/codecs.html#codec-objects)
    - [7.2.1.2. Объекты IncrementalEncoder](https://python-all.ru/3.3/library/codecs.html#incrementalencoder-objects)
    - [7.2.1.3. Объекты IncrementalDecoder](https://python-all.ru/3.3/library/codecs.html#incrementaldecoder-objects)
    - [7.2.1.4. Объекты StreamWriter](https://python-all.ru/3.3/library/codecs.html#streamwriter-objects)
    - [7.2.1.5. Объекты StreamReader](https://python-all.ru/3.3/library/codecs.html#streamreader-objects)
    - [7.2.1.6. Объекты StreamReaderWriter](https://python-all.ru/3.3/library/codecs.html#streamreaderwriter-objects)
    - [7.2.1.7. Объекты StreamRecoder](https://python-all.ru/3.3/library/codecs.html#streamrecoder-objects)
  - [7.2.2. Кодировки и Юникод](https://python-all.ru/3.3/library/codecs.html#encodings-and-unicode)
  - [7.2.3. Стандартные кодировки](https://python-all.ru/3.3/library/codecs.html#standard-encodings)
  - [7.2.4. Кодировки, специфичные для Python](https://python-all.ru/3.3/library/codecs.html#python-specific-encodings)
  - [7.2.5. `encodings.idna` – Интернационализированные доменные имена в приложениях](https://python-all.ru/3.3/library/codecs.html#module-encodings.idna)
  - [7.2.6. `encodings.mbcs` – Кодовая страница Windows ANSI](https://python-all.ru/3.3/library/codecs.html#module-encodings.mbcs)
  - [7.2.7. `encodings.utf_8_sig` – Кодек UTF-8 с сигнатурой BOM](https://python-all.ru/3.3/library/codecs.html#module-encodings.utf_8_sig)
