标签:分享图片 too import 代码块 -- png order 时间戳 alt
1.从?到?的顺序: ?条代码 < 语句块 < 代码块(函数, 类) < 模块
2.引入模块的方式
① import 模块
② from 模块 import 功能


1.时间戳 从1970-01-01 00:00:00 开始以 秒 计算
东八区 从1970-01-01 08:00:00
time.time() 用于时间存储

2.格式化



3.结构化(python的时间)

4 转化
①

②

四. collections 模块
1.counter (可迭代对象) 计数
每一个元素出现的次数
获取到的结果可以像字典?样进?使?
2.defaultdict( lambda:0) 默认值字典
3.OrderedDict( ) 将字典有序化
4.数据结构( 栈 队列)
①栈: 先进后出


②队列: 先进先出

③双向

5.namedtuple 命名元组
类似创建一个类
面向对象:

命名元组:

五.functools 模块
1.wraps (装饰器中) 可以改变一个函数的名字 ,注释

2.reduce 归纳

3.partial 偏函数 固定函数中的参数
新函数 = (旧参数,固定值)

python之路---22 初始模块 random time collections functools
标签:分享图片 too import 代码块 -- png order 时间戳 alt
原文地址:https://www.cnblogs.com/amirky/p/10211595.html