数据类型¶
The modules described in this chapter provide a variety of specialized data types such as dates and times, fixed-type arrays, heap queues, double-ended queues, and enumerations.
Python also provides some built-in data types, in particular,
dict, list, set and frozenset, and
tuple. The str class is used to hold
Unicode strings, and the bytes and bytearray classes are used
to hold binary data.
本章包含以下模块的文档:
datetime--- 基本的日期和时间类型calendar--- 日历相关函数collections--- 容器数据类型collections.abc--- 容器的抽象基类heapq--- 堆队列算法bisect--- 数组二分查找算法array--- 高效的数值数组weakref--- 弱引用types--- 动态类型创建和内置类型名称copy--- 浅层 (shallow) 和深层 (deep) 复制操作pprint--- 数据美化输出reprlib--- 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
- 比较
- 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?
