python-day21(模块初级)

一. 关于模块

  import  xxx

  from xxx import xxx

二. Collections

  1. Counter 计数器

  2. 栈: 先进先出

    队列: 先进先出

    deque: 双向队列

  3. defaultdict 默认值字典

  4. namedtuple 命名元祖. struc_time 结构化时间就是命名元祖

  5. OreddereDict 有序字典. 按照我们储存的顺序保存. 和3.6以后 的字典一样的

三. time时间模块

  1. 获取系统时间 time.time() 时间戳

  2. 格式化时间 strftime()  时间格式: %Y-%m-%d    %H:%M:%S

  3. 结构化时间 time.gmtime()  time.localtime()

  strptime() 把格式化时间转化成结构化时间

  mktime() 把结构化时间转化成时间戳

  

  时间差的计算

四. os和sys

  os.spe 文件路劲分隔符

  sys.path  python查找模块的路径

猜你喜欢

转载自www.cnblogs.com/Thui/p/9959737.html
今日推荐