在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