数据类型
********

本章所描述的模块提供了许多专门的数据类型，如日期和时间、固定类型的数组
、堆队列、双端队列、以及枚举。

Python也提供一些内置数据类型，特别是，"dict"、 "list"、"set"、
"frozenset"、以及 "tuple"。"str" 这个类是用来存储Unicode字符串的，而
"bytes" 和 "bytearray" 这两个类是用来存储二进制数据的。

本章包含以下模块的文档：

* "datetime" --- 基本日期和时间类型

  * 感知型对象和简单型对象

  * 常量

    * "MINYEAR"

    * "MAXYEAR"

    * "UTC"

  * 有效的类型

    * 通用的特征属性

    * 确定一个对象是感知型还是简单型

  * "timedelta" 类对象

    * "timedelta"

    * "min"

    * "max"

    * "resolution"

    * "days"

    * "seconds"

    * "microseconds"

    * "total_seconds()"

    * "timedelta" 用法示例

  * "date" 对象

    * "date"

    * "today()"

    * "fromtimestamp()"

    * "fromordinal()"

    * "fromisoformat()"

    * "fromisocalendar()"

    * "strptime()"

    * "min"

    * "max"

    * "resolution"

    * "year"

    * "month"

    * "day"

    * "replace()"

    * "timetuple()"

    * "toordinal()"

    * "weekday()"

    * "isoweekday()"

    * "isocalendar()"

    * "isoformat()"

    * "__str__()"

    * "ctime()"

    * "strftime()"

    * "__format__()"

    * "date" 用法示例

  * "datetime" 对象

    * "datetime"

    * "today()"

    * "now()"

    * "utcnow()"

    * "fromtimestamp()"

    * "utcfromtimestamp()"

    * "fromordinal()"

    * "combine()"

    * "fromisoformat()"

    * "fromisocalendar()"

    * "strptime()"

    * "min"

    * "max"

    * "resolution"

    * "year"

    * "month"

    * "day"

    * "hour"

    * "minute"

    * "second"

    * "microsecond"

    * "tzinfo"

    * "fold"

    * "date()"

    * "time()"

    * "timetz()"

    * "replace()"

    * "astimezone()"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * "timetuple()"

    * "utctimetuple()"

    * "toordinal()"

    * "timestamp()"

    * "weekday()"

    * "isoweekday()"

    * "isocalendar()"

    * "isoformat()"

    * "__str__()"

    * "ctime()"

    * "strftime()"

    * "__format__()"

    * 用法示例: "datetime"

  * "time" 对象

    * "time"

    * "min"

    * "max"

    * "resolution"

    * "hour"

    * "minute"

    * "second"

    * "microsecond"

    * "tzinfo"

    * "fold"

    * "fromisoformat()"

    * "strptime()"

    * "replace()"

    * "isoformat()"

    * "__str__()"

    * "strftime()"

    * "__format__()"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * 用法示例: "time"

  * "tzinfo" 对象

    * "tzinfo"

    * "utcoffset()"

    * "dst()"

    * "tzname()"

    * "fromutc()"

  * "timezone" 对象

    * "timezone"

    * "utcoffset()"

    * "tzname()"

    * "dst()"

    * "fromutc()"

    * "utc"

  * "strftime()" 和 "strptime()" 的行为

    * "strftime()" 和 "strptime()" 格式码

    * 技术细节

* "zoneinfo" --- IANA 时区支持

  * 使用 "ZoneInfo"

  * 数据源

    * 配置数据源

      * 编译时配置

      * 环境配置

      * 运行时配置

  * "ZoneInfo" 类

    * "ZoneInfo"

    * "from_file()"

    * "no_cache()"

    * "clear_cache()"

    * "key"

    * 字符串表示

    * 封存序列化

  * 函数

    * "available_timezones()"

    * "reset_tzpath()"

  * 全局变量

    * "TZPATH"

  * 异常与警告

    * "ZoneInfoNotFoundError"

    * "InvalidTZPathWarning"

* "calendar" --- 通用日历相关函数

  * "Calendar"

    * "iterweekdays()"

    * "itermonthdates()"

    * "itermonthdays()"

    * "itermonthdays2()"

    * "itermonthdays3()"

    * "itermonthdays4()"

    * "monthdatescalendar()"

    * "monthdays2calendar()"

    * "monthdayscalendar()"

    * "yeardatescalendar()"

    * "yeardays2calendar()"

    * "yeardayscalendar()"

  * "TextCalendar"

    * "formatmonth()"

    * "prmonth()"

    * "formatyear()"

    * "pryear()"

  * "HTMLCalendar"

    * "formatmonth()"

    * "formatyear()"

    * "formatyearpage()"

    * "formatmonthname()"

    * "cssclasses"

    * "cssclass_noday"

    * "cssclasses_weekday_head"

    * "cssclass_month_head"

    * "cssclass_month"

    * "cssclass_year"

    * "cssclass_year_head"

  * "LocaleTextCalendar"

  * "LocaleHTMLCalendar"

  * "setfirstweekday()"

  * "firstweekday()"

  * "isleap()"

  * "leapdays()"

  * "weekday()"

  * "weekheader()"

  * "monthrange()"

  * "monthcalendar()"

  * "prmonth()"

  * "month()"

  * "prcal()"

  * "calendar()"

  * "timegm()"

  * "day_name"

  * "day_abbr"

  * "MONDAY"

  * "TUESDAY"

  * "WEDNESDAY"

  * "THURSDAY"

  * "FRIDAY"

  * "SATURDAY"

  * "SUNDAY"

  * "Day"

  * "month_name"

  * "month_abbr"

  * "JANUARY"

  * "FEBRUARY"

  * "MARCH"

  * "APRIL"

  * "MAY"

  * "JUNE"

  * "JULY"

  * "AUGUST"

  * "SEPTEMBER"

  * "OCTOBER"

  * "NOVEMBER"

  * "DECEMBER"

  * "Month"

  * "IllegalMonthError"

    * "month"

  * "IllegalWeekdayError"

    * "weekday"

  * 命令行用法

* "collections" --- 容器数据类型

  * "ChainMap" 对象

    * "ChainMap"

      * "maps"

      * "new_child()"

      * "parents"

    * "ChainMap" 例子和方法

  * "Counter" 对象

    * "Counter"

      * "elements()"

      * "most_common()"

      * "subtract()"

      * "total()"

      * "fromkeys()"

      * "update()"

  * "deque" 对象

    * "deque"

      * "append()"

      * "appendleft()"

      * "clear()"

      * "copy()"

      * "count()"

      * "extend()"

      * "extendleft()"

      * "index()"

      * "insert()"

      * "pop()"

      * "popleft()"

      * "remove()"

      * "reverse()"

      * "rotate()"

      * "maxlen"

    * "deque" 用法

  * "defaultdict" 对象

    * "defaultdict"

      * "__missing__()"

      * "default_factory"

    * "defaultdict" 例子

  * "namedtuple()" 命名元组的工厂函数

    * "namedtuple()"

    * "_make()"

    * "_asdict()"

    * "_replace()"

    * "_fields"

    * "_field_defaults"

  * "OrderedDict" 对象

    * "OrderedDict"

      * "popitem()"

      * "move_to_end()"

    * "OrderedDict" 例子和用法

  * "UserDict" 对象

    * "UserDict"

      * "data"

  * "UserList" 对象

    * "UserList"

      * "data"

  * "UserString" 对象

    * "UserString"

      * "data"

* "collections.abc" --- 容器的抽象基类

  * 容器抽象基类

  * 多项集抽象基类 -- 详细描述

    * "Container"

    * "Hashable"

    * "Sized"

    * "Callable"

    * "Iterable"

    * "Collection"

    * "Iterator"

    * "Reversible"

    * "Generator"

    * "Sequence"

    * "MutableSequence"

    * "Set"

    * "MutableSet"

    * "Mapping"

    * "MutableMapping"

    * "MappingView"

    * "ItemsView"

    * "KeysView"

    * "ValuesView"

    * "Awaitable"

    * "Coroutine"

    * "AsyncIterable"

    * "AsyncIterator"

    * "AsyncGenerator"

    * "Buffer"

  * 例子和配方

* "heapq" --- 堆队列算法

  * "heappush()"

  * "heappop()"

  * "heappushpop()"

  * "heapify()"

  * "heapreplace()"

  * "merge()"

  * "nlargest()"

  * "nsmallest()"

  * 基本示例

  * 优先队列实现说明

  * 理论

* "bisect" --- 数组二分算法

  * "bisect_left()"

  * "bisect_right()"

  * "bisect()"

  * "insort_left()"

  * "insort_right()"

  * "insort()"

  * 性能说明

  * 搜索有序列表

  * 例子

* "array" --- 高效的数字值数组

  * "typecodes"

  * "array"

    * "typecode"

    * "itemsize"

    * "append()"

    * "buffer_info()"

    * "byteswap()"

    * "count()"

    * "extend()"

    * "frombytes()"

    * "fromfile()"

    * "fromlist()"

    * "fromunicode()"

    * "index()"

    * "insert()"

    * "pop()"

    * "remove()"

    * "clear()"

    * "reverse()"

    * "tobytes()"

    * "tofile()"

    * "tolist()"

    * "tounicode()"

* "weakref" --- 弱引用

  * "ref"

    * "__callback__"

  * "proxy()"

  * "getweakrefcount()"

  * "getweakrefs()"

  * "WeakKeyDictionary"

  * "keyrefs()"

  * "WeakValueDictionary"

  * "valuerefs()"

  * "WeakSet"

  * "WeakMethod"

  * "finalize"

    * "__call__()"

    * "detach()"

    * "peek()"

    * "alive"

    * "atexit"

  * "ReferenceType"

  * "ProxyType"

  * "CallableProxyType"

  * "ProxyTypes"

  * 弱引用对象

  * 示例

  * 终结器对象

  * 比较终结器与 "__del__()" 方法

* "types" --- 动态类型创建和内置类型名称

  * 动态类型创建

    * "new_class()"

    * "prepare_class()"

    * "resolve_bases()"

    * "get_original_bases()"

  * 标准解释器类型

    * "NoneType"

    * "FunctionType"

    * "LambdaType"

    * "GeneratorType"

    * "CoroutineType"

    * "AsyncGeneratorType"

    * "CodeType"

    * "CellType"

    * "MethodType"

    * "BuiltinFunctionType"

    * "BuiltinMethodType"

    * "WrapperDescriptorType"

    * "MethodWrapperType"

    * "NotImplementedType"

    * "MethodDescriptorType"

    * "ClassMethodDescriptorType"

    * "ModuleType"

    * "EllipsisType"

    * "GenericAlias"

    * "UnionType"

    * "TracebackType"

    * "FrameType"

    * "GetSetDescriptorType"

    * "MemberDescriptorType"

    * "MappingProxyType"

      * "copy()"

      * "get()"

      * "items()"

      * "keys()"

      * "values()"

    * "CapsuleType"

  * 附加工具类和函数

    * "SimpleNamespace"

    * "DynamicClassAttribute()"

  * 协程工具函数

    * "coroutine()"

* "copy" --- 浅层及深层拷贝操作

  * "copy()"

  * "deepcopy()"

  * "replace()"

  * "Error"

  * "__copy__()"

  * "__deepcopy__()"

  * "__replace__()"

* "pprint" --- 数据美化输出

  * 函数

    * "pp()"

    * "pprint()"

    * "pformat()"

    * "isreadable()"

    * "isrecursive()"

    * "saferepr()"

  * PrettyPrinter 对象

    * "PrettyPrinter"

    * "pformat()"

    * "pprint()"

    * "isreadable()"

    * "isrecursive()"

    * "format()"

  * 示例

* "reprlib" --- 替代性 "repr()" 实现

  * "Repr"

  * "aRepr"

  * "repr()"

  * "recursive_repr()"

  * Repr 对象

    * "fillvalue"

    * "maxlevel"

    * "maxdict"

    * "maxlist"

    * "maxtuple"

    * "maxset"

    * "maxfrozenset"

    * "maxdeque"

    * "maxarray"

    * "maxlong"

    * "maxstring"

    * "maxother"

    * "indent"

    * "repr()"

    * "repr1()"

  * 子类化 Repr 对象

* "enum" --- 对枚举的支持

  * 模块内容

  * 数据类型

    * "EnumType"

      * "__call__()"

      * "__contains__()"

      * "__dir__()"

      * "__getitem__()"

      * "__iter__()"

      * "__len__()"

      * "__members__"

      * "__reversed__()"

      * "_add_alias_()"

      * "_add_value_alias_()"

    * "Enum"

      * "name"

      * "value"

      * "_name_"

      * "_value_"

      * "_order_"

      * "_ignore_"

      * "__dir__()"

      * "_generate_next_value_()"

      * "__init__()"

      * "__init_subclass__()"

      * "_missing_()"

      * "__new__()"

      * "__repr__()"

      * "__str__()"

      * "__format__()"

    * "IntEnum"

    * "StrEnum"

    * "Flag"

      * "__contains__()"

      * "__or__()"

      * "__and__()"

      * "__xor__()"

      * "_numeric_repr_()"

    * "IntFlag"

    * "ReprEnum"

    * "EnumCheck"

      * "UNIQUE"

      * "CONTINUOUS"

      * "NAMED_FLAGS"

    * "FlagBoundary"

      * "STRICT"

      * "CONFORM"

      * "EJECT"

      * "KEEP"

    * "EnumDict"

      * "member_names"

    * 支持的 "__dunder__" 名称

    * 支持的 "_sunder_" 名称

  * 工具与装饰器

    * "auto"

    * "property()"

    * "unique()"

    * "verify()"

    * "member()"

    * "nonmember()"

    * "global_enum()"

    * "show_flag_values()"

  * 备注

* "graphlib" --- 操作类似图的结构的功能

  * "TopologicalSorter"

    * "add()"

    * "prepare()"

    * "is_active()"

    * "done()"

    * "get_ready()"

    * "static_order()"

  * 异常

    * "CycleError"
