码迷,mamicode.com
首页 > 编程语言 > 详细

python time模块

时间:2017-01-09 00:51:30      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:python time

1.python 中的time 模块

  time模块主要是进行时间上处理.我用一个图来表示time,其中涉及到三种概念:时间戳,时间结构体,

时间字符串

技术分享

time 模块主要是处理这三个的关系.

2.time模块中的函数介绍.

    2.1 time.localtime() 这个函数用于将时间戳  转换成time_struct 时间,不传参,默认是当前的时间戳.

      2.2 time.time() 获取当前的时间戳,

      2.3 mktime 获取时间戳,输入参数是 时间结构体 time_struct


      2.4 strftime(format,struct time) 将时间结构体 转换成时间字符串.

      2.5 strptime(str, format) 将字符串转换成 time struct. 

      2.6 asctime() 有时间戳 转换成时间字符串

      2.7 clock()  获取CPU占用时的时间戳.

Python中时间模块很多,有time,datetime,calender。

python time模块

标签:python time

原文地址:http://7059184.blog.51cto.com/7049184/1890236

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!