模块1

random

Counter

默认值字典

栈和队列,双向队列

time

functools

random 主要是和随机相关的内容

 random()    随机小数
uninform(a,b) 随机小数

randint(a,b) 随机整数

choice() 随机选择一个
sample() 随机选择多个

shuffle() 打乱

2. Collections
1. Counter 计数器
2. defaultdict 默认值字典
3. OrderedDict 有序字典
数据结构(队列, 栈(重点))

栈:先进后出
Stack

队列: 先进先出
Queue

3. Time模块
时间有三种:
结构化时间 gmtime() localtime()
时间戳 time.time() time.mktime()
格式化时间 time.strftime() time.strptime()

时间转化:
数字 -> 字符串
struct_time = time.localtime(数字)
str = time.strftime("格式", struct_time)

字符串 -> 数字
struct_time = time.strptime(字符串, "格式")
num = time.mktime(struct_time)

4. functools
wraps 给装饰器中的inner改名字
reduce 归纳.
偏函数 把函数的参数固定.
原文地址:https://www.cnblogs.com/YangWenYu-6/p/10209752.html