Типи даних¶
Модулі, описані в цьому розділі, надають різні спеціалізовані типи даних, такі як дати та час, масиви фіксованого типу, черги купи, двосторонні черги та перерахування.
Python також надає деякі вбудовані типи даних, зокрема dict, list, set і frozenset і tuple. Клас str використовується для зберігання рядків Unicode, а класи bytes і bytearray використовуються для зберігання двійкових даних.
У цьому розділі описано наступні модулі:
datetime— Basic date and time typeszoneinfo— IANA time zone supportcalendar— General calendar-related functionscollections— Container datatypescollections.abc— Abstract Base Classes for Containersheapq— Heap queue algorithmbisect— Array bisection algorithmarray— Efficient arrays of numeric valuesweakref— Слабкі посиланняtypes— Dynamic type creation and names for built-in typescopy— Shallow and deep copy operationspprint— Data pretty printerreprlib— Alternaterepr()implementationenum— Support for enumerations- Зміст модуля
- Creating an Enum
- Programmatic access to enumeration members and their attributes
- Duplicating enum members and values
- Ensuring unique enumeration values
- Using automatic values
- Iteration
- Comparisons
- Allowed members and attributes of enumerations
- Restricted Enum subclassing
- Pickling
- Functional API
- Derived Enumerations
- When to use
__new__()vs.__init__() - Interesting examples
- How are Enums different?
graphlib— Functionality to operate with graph-like structures