首页 > IT职业 > IT职场 > 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
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1536/viewspace-2836092/ ,如需转载,请注明出处,否则将追究法律责任。