后浪云Python教程:python 如何获取毫秒级系统时间
相关推荐:《Python基础教程》
import time import datetime t = time.time() print (t) #原始时间数据 print (int(t)) #秒级时间戳 print (int(round(t * 1000))) #毫秒级时间戳 nowTime = lambda:int(round(t * 1000)) print (nowTime()); #毫秒级时间戳,基于lambda print (datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) #日期格式化
结果如下:
1499825149.26 1499825149 1499825149257 1499825149257 2017-07-12 10:05:49
版权声明:
作者:后浪云
链接:https://www.idc.net/help/169436/
文章版权归作者所有,未经允许请勿转载。
THE END