在Python中获取当前时间(以毫秒为单位)? [英] Get current time in milliseconds in Python?
本文介绍了在Python中获取当前时间(以毫秒为单位)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Python中获得当前时间(以毫秒为单位)?
How can I get the current time in milliseconds in Python?
推荐答案
对于我需要的,这是我做的,基于@samplebias的评论:
For what I needed, here's what I did, based on @samplebias' comment above:
import time
millis = int(round(time.time() * 1000))
print millis
Quick'n'easy。感谢所有,抱歉的大脑屁。
Quick'n'easy. Thanks all, sorry for the brain fart.
为了重用:
import time
current_milli_time = lambda: int(round(time.time() * 1000))
然后:
>>> current_milli_time()
1378761833768
这篇关于在Python中获取当前时间(以毫秒为单位)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文