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

---

# Типы данных

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

Python также предоставляет несколько встроенных типов данных, в частности, [`dict`](https://python-all.ru/3.7/library/stdtypes.html#dict), [`list`](https://python-all.ru/3.7/library/stdtypes.html#list), [`set`](https://python-all.ru/3.7/library/stdtypes.html#set), [`frozenset`](https://python-all.ru/3.7/library/stdtypes.html#frozenset) и [`tuple`](https://python-all.ru/3.7/library/stdtypes.html#tuple). Класс [`str`](https://python-all.ru/3.7/library/stdtypes.html#str) используется для хранения строк Unicode, а классы [`bytes`](https://python-all.ru/3.7/library/stdtypes.html#bytes) и [`bytearray`](https://python-all.ru/3.7/library/stdtypes.html#bytearray) используются для хранения двоичных данных.

В этой главе описаны следующие модули:

- [`datetime` – базовые типы даты и времени](https://python-all.ru/3.7/library/datetime.html)

  - [Доступные типы](https://python-all.ru/3.7/library/datetime.html#available-types)
  - [Объекты `timedelta`](https://python-all.ru/3.7/library/datetime.html#timedelta-objects)
  - [Объекты `date`](https://python-all.ru/3.7/library/datetime.html#date-objects)
  - [Объекты `datetime`](https://python-all.ru/3.7/library/datetime.html#datetime-objects)
  - [Объекты `time`](https://python-all.ru/3.7/library/datetime.html#time-objects)
  - [Объекты `tzinfo`](https://python-all.ru/3.7/library/datetime.html#tzinfo-objects)
  - [Объекты `timezone`](https://python-all.ru/3.7/library/datetime.html#timezone-objects)
  - [Поведение `strftime()` и `strptime()`](https://python-all.ru/3.7/library/datetime.html#strftime-and-strptime-behavior)
- [`calendar` – общие функции для работы с календарём](https://python-all.ru/3.7/library/calendar.html)
- [`collections` – контейнерные типы данных](https://python-all.ru/3.7/library/collections.html)

  - [`ChainMap` объекты](https://python-all.ru/3.7/library/collections.html#chainmap-objects)

    - [Примеры и рецепты `ChainMap`](https://python-all.ru/3.7/library/collections.html#chainmap-examples-and-recipes)
  - [`Counter` объекты](https://python-all.ru/3.7/library/collections.html#counter-objects)
  - [`deque` объекты](https://python-all.ru/3.7/library/collections.html#deque-objects)

    - [Рецепты `deque`](https://python-all.ru/3.7/library/collections.html#deque-recipes)
  - [`defaultdict` объекты](https://python-all.ru/3.7/library/collections.html#defaultdict-objects)

    - [Примеры `defaultdict`](https://python-all.ru/3.7/library/collections.html#defaultdict-examples)
  - [`namedtuple()` – фабричная функция для кортежей с именованными полями](https://python-all.ru/3.7/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields)
  - [`OrderedDict` объекты](https://python-all.ru/3.7/library/collections.html#ordereddict-objects)

    - [Примеры и рецепты `OrderedDict`](https://python-all.ru/3.7/library/collections.html#ordereddict-examples-and-recipes)
  - [`UserDict` объекты](https://python-all.ru/3.7/library/collections.html#userdict-objects)
  - [`UserList` объекты](https://python-all.ru/3.7/library/collections.html#userlist-objects)
  - [`UserString` объекты](https://python-all.ru/3.7/library/collections.html#userstring-objects)
- [`collections.abc` – абстрактные базовые классы для контейнеров](https://python-all.ru/3.7/library/collections.abc.html)

  - [Абстрактные базовые классы коллекций](https://python-all.ru/3.7/library/collections.abc.html#collections-abstract-base-classes)
- [`heapq` – алгоритм кучи (очередь с приоритетом)](https://python-all.ru/3.7/library/heapq.html)

  - [Основные примеры](https://python-all.ru/3.7/library/heapq.html#basic-examples)
  - [Примечания к реализации очереди с приоритетом](https://python-all.ru/3.7/library/heapq.html#priority-queue-implementation-notes)
  - [Теория](https://python-all.ru/3.7/library/heapq.html#theory)
- [`bisect` – алгоритм бисекции массива](https://python-all.ru/3.7/library/bisect.html)

  - [Поиск в отсортированных списках](https://python-all.ru/3.7/library/bisect.html#searching-sorted-lists)
  - [Другие примеры](https://python-all.ru/3.7/library/bisect.html#other-examples)
- [`array` – эффективные массивы числовых значений](https://python-all.ru/3.7/library/array.html)
- [`weakref` – слабые ссылки](https://python-all.ru/3.7/library/weakref.html)

  - [Объекты слабых ссылок](https://python-all.ru/3.7/library/weakref.html#weak-reference-objects)
  - [Пример](https://python-all.ru/3.7/library/weakref.html#example)
  - [Объекты финализаторов](https://python-all.ru/3.7/library/weakref.html#finalizer-objects)
  - [Сравнение финализаторов с методами `__del__()`](https://python-all.ru/3.7/library/weakref.html#comparing-finalizers-with-del-methods)
- [`types` – динамическое создание типов и имена для встроенных типов](https://python-all.ru/3.7/library/types.html)

  - [Динамическое создание типов](https://python-all.ru/3.7/library/types.html#dynamic-type-creation)
  - [Стандартные типы интерпретатора](https://python-all.ru/3.7/library/types.html#standard-interpreter-types)
  - [Дополнительные вспомогательные классы и функции](https://python-all.ru/3.7/library/types.html#additional-utility-classes-and-functions)
  - [Вспомогательные функции для корутин](https://python-all.ru/3.7/library/types.html#coroutine-utility-functions)
- [`copy` – операции поверхностного и глубокого копирования](https://python-all.ru/3.7/library/copy.html)
- [`pprint` – форматированный вывод данных](https://python-all.ru/3.7/library/pprint.html)

  - [Объекты PrettyPrinter](https://python-all.ru/3.7/library/pprint.html#prettyprinter-objects)
  - [Пример](https://python-all.ru/3.7/library/pprint.html#example)
- [`reprlib` – альтернативная `repr()` реализация](https://python-all.ru/3.7/library/reprlib.html)

  - [Объекты Repr](https://python-all.ru/3.7/library/reprlib.html#repr-objects)
  - [Создание подклассов Repr](https://python-all.ru/3.7/library/reprlib.html#subclassing-repr-objects)
- [`enum` – поддержка перечислений](https://python-all.ru/3.7/library/enum.html)

  - [Содержимое модуля](https://python-all.ru/3.7/library/enum.html#module-contents)
  - [Создание Enum](https://python-all.ru/3.7/library/enum.html#creating-an-enum)
  - [Программный доступ к элементам перечисления и их атрибутам](https://python-all.ru/3.7/library/enum.html#programmatic-access-to-enumeration-members-and-their-attributes)
  - [Дублирование элементов и значений перечисления](https://python-all.ru/3.7/library/enum.html#duplicating-enum-members-and-values)
  - [Обеспечение уникальности значений перечисления](https://python-all.ru/3.7/library/enum.html#ensuring-unique-enumeration-values)
  - [Использование автоматических значений](https://python-all.ru/3.7/library/enum.html#using-automatic-values)
  - [Итерация](https://python-all.ru/3.7/library/enum.html#iteration)
  - [Сравнения](https://python-all.ru/3.7/library/enum.html#comparisons)
  - [Допустимые элементы и атрибуты перечислений](https://python-all.ru/3.7/library/enum.html#allowed-members-and-attributes-of-enumerations)
  - [Ограниченное создание подклассов Enum](https://python-all.ru/3.7/library/enum.html#restricted-enum-subclassing)
  - [Сериализация pickle](https://python-all.ru/3.7/library/enum.html#pickling)
  - [Функциональный API](https://python-all.ru/3.7/library/enum.html#functional-api)
  - [Производные перечисления](https://python-all.ru/3.7/library/enum.html#derived-enumerations)

    - [IntEnum](https://python-all.ru/3.7/library/enum.html#intenum)
    - [IntFlag](https://python-all.ru/3.7/library/enum.html#intflag)
    - [Flag](https://python-all.ru/3.7/library/enum.html#flag)
    - [Другие](https://python-all.ru/3.7/library/enum.html#others)
  - [Интересные примеры](https://python-all.ru/3.7/library/enum.html#interesting-examples)

    - [Пропуск значений](https://python-all.ru/3.7/library/enum.html#omitting-values)

      - [Использование `auto`](https://python-all.ru/3.7/library/enum.html#using-auto)
      - [Использование `object`](https://python-all.ru/3.7/library/enum.html#using-object)
      - [Использование описательной строки](https://python-all.ru/3.7/library/enum.html#using-a-descriptive-string)
      - [Использование пользовательского `__new__()`](https://python-all.ru/3.7/library/enum.html#using-a-custom-new)
    - [OrderedEnum](https://python-all.ru/3.7/library/enum.html#orderedenum)
    - [DuplicateFreeEnum](https://python-all.ru/3.7/library/enum.html#duplicatefreeenum)
    - [Планета](https://python-all.ru/3.7/library/enum.html#planet)
    - [ВременнойПериод](https://python-all.ru/3.7/library/enum.html#timeperiod)
  - [Чем различаются перечисления?](https://python-all.ru/3.7/library/enum.html#how-are-enums-different)

    - [Классы Enum](https://python-all.ru/3.7/library/enum.html#enum-classes)
    - [Члены Enum (экземпляры)](https://python-all.ru/3.7/library/enum.html#enum-members-aka-instances)
    - [Тонкие моменты](https://python-all.ru/3.7/library/enum.html#finer-points)

      - [Поддерживаемые `__dunder__` имена](https://python-all.ru/3.7/library/enum.html#supported-dunder-names)
      - [Поддерживаемые `_sunder_` имена](https://python-all.ru/3.7/library/enum.html#supported-sunder-names)
      - [Тип элемента `Enum`](https://python-all.ru/3.7/library/enum.html#enum-member-type)
      - [Логическое значение классов и элементов `Enum`](https://python-all.ru/3.7/library/enum.html#boolean-value-of-enum-classes-and-members)
      - [Классы `Enum` с методами](https://python-all.ru/3.7/library/enum.html#enum-classes-with-methods)
      - [Объединение элементов `Flag`](https://python-all.ru/3.7/library/enum.html#combining-members-of-flag)
