python time模块

time模块 (有效时间1970-2038)

(1)本地时间

(2)时间戳

(3)延时

1 time.localtime([secs])   #struct_time
2 time.time()    #timestamp
3 time.sleep(secs)
View Code

 格式化:

%Y 年

%m 月

%d 日

%H(24) %I(12) 时

%M 分

%S 秒

%a 本地星期

%b 本地月份

%j 年内的第几天

%X 本地时间

 

 time.clock() 返回第一次调用该方法到现在的秒数,其精确度高于1微妙。

原文地址:https://www.cnblogs.com/todayisafineday/p/6083562.html