time模块
time.time()
得到当前时间戳(1970年到现在的浮点秒数)
time.sleep(n)
休眠n秒
print "time.time(): %f " % time.time() print time.localtime( time.time()) print time.asctime( time.localtime(time.time())) >> time.time(): 1234892919.655932 (2009, 2, 17, 10, 48, 39, 1, 48, 0) Tue Feb 17 10:48:39 2009
print(time.strftime('%Y%m%d',time.localtime(time.time()))) >>> 20180704
Unix时间戳规范
UNIX时间戳的0按照ISO 8601规范为 :1970-01-01T00:00:00Z.