数据类型¶
本章所描述的模块提供了许多专门的数据类型,如日期和时间、固定类型的数组、堆队列、双端队列、以及枚举。
Python也提供一些内置数据类型,特别是,dict、 list、set、frozenset、以及 tuple。str 这个类是用来存储Unicode字符串的,而 bytes 和 bytearray 这两个类是用来存储二进制数据的。
本章包含以下模块的文档:
datetime--- 基本日期和时间类型- 感知型对象和简单型对象
 - 常量
 - 有效的类型
 timedelta类对象date对象datetime对象datetimetoday()now()utcnow()fromtimestamp()utcfromtimestamp()fromordinal()combine()fromisoformat()fromisocalendar()strptime()minmaxresolutionyearmonthdayhourminutesecondmicrosecondtzinfofolddate()time()timetz()replace()astimezone()utcoffset()dst()tzname()timetuple()utctimetuple()toordinal()timestamp()weekday()isoweekday()isocalendar()isoformat()__str__()ctime()strftime()__format__()- 用法示例: 
datetime 
time对象tzinfo对象timezone对象strftime()和strptime()的行为
zoneinfo--- IANA 时区支持calendar--- 通用日历相关函数CalendarTextCalendarHTMLCalendarLocaleTextCalendarLocaleHTMLCalendarsetfirstweekday()firstweekday()isleap()leapdays()weekday()weekheader()monthrange()monthcalendar()prmonth()month()prcal()calendar()timegm()day_nameday_abbrMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAYDaymonth_namemonth_abbrJANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUSTSEPTEMBEROCTOBERNOVEMBERDECEMBERMonthIllegalMonthErrorIllegalWeekdayError- 命令行用法
 
collections--- 容器数据类型collections.abc--- 容器的抽象基类heapq--- 堆队列算法bisect--- 数组二分算法array--- 高效的数字值数组weakref--- 弱引用types--- 动态类型创建和内置类型名称- 动态类型创建
 - 标准解释器类型
NoneTypeFunctionTypeLambdaTypeGeneratorTypeCoroutineTypeAsyncGeneratorTypeCodeTypeCellTypeMethodTypeBuiltinFunctionTypeBuiltinMethodTypeWrapperDescriptorTypeMethodWrapperTypeNotImplementedTypeMethodDescriptorTypeClassMethodDescriptorTypeModuleTypeEllipsisTypeGenericAliasUnionTypeTracebackTypeFrameTypeGetSetDescriptorTypeMemberDescriptorTypeMappingProxyType
 - 附加工具类和函数
 - 协程工具函数
 
copy--- 浅层及深层拷贝操作pprint--- 数据美化输出reprlib--- 替代性repr()实现enum--- 对枚举的支持graphlib--- 操作类似图的结构的功能