change ati convert parse min alt ring timezone
- time模块下只有若干个方法,没有类,所以直接用time.方法即可1.time()--
- return current time in seconds since the Epoch as a floatprint time.time()返回日期的秒数1492351508.722.clock()--
- return CPU time since process start as a float输出CPU时间3.sleep()--delay
- for a number of seconds given as a float4.gmtime()--convert seconds since Epoch to UTC tuple5.localtime()--convert seconds since Epoch to local time tuple把时间戳转为time.time_struct格式的时间数组print time.localtime(time.time())time.struct_time(tm_year = 2017, tm_mon = 4, tm_mday = 16, tm_hour = 22, tm_min = 14, tm_sec = 57, tm_wday = 6, tm_yday = 106, tm_isdst = 0) 6.asctime()--convert time tuple to string把时间数组转换为字符串print time.asctime(time.localtime(time.time()))Sun Apr 16 22 : 27 : 11 2017
- 7.ctime() -- convert time in seconds to string把以秒表示的时间转为字符串print time.ctime(time.time())Sun Apr 16 22:27:57 2017
- 8.mktime() -- convert local time tuple to seconds since Epoch把时间数组转为秒表示print time.mktime(time.localtime(time.time()))1492352997.0
- 9.strftime() -- convert time tuple to string according to format specification10.strptime() -- parse string to time tuple according to format specification11.tzset() -- change the local timezone
Python 的 time 模块
来源: http://www.bubuko.com/infodetail-2028515.html