python打印ms

Posted 小心走火

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python打印ms相关的知识,希望对你有一定的参考价值。

ct打印的是时间戳,时间戳的小数点后前三位为ms  eg:1555644362.055328   ms = 055

import time

ct = time.time()
local_time = time.localtime(ct)
data_head = time.strftime("%Y-%m-%d %H:%M:%S", local_time)
data_secs = (ct - int(ct))  * 1000
time_stamp = "%s.%03d" % (data_head, data_secs)
print(ct)
print(local_time)
print(data_head)
print(time_stamp)

 

以上是关于python打印ms的主要内容,如果未能解决你的问题,请参考以下文章