获取总运行时间(以毫秒为单位)

时间:2019-02-28 05:10:29

标签: python time

如何找到以毫秒为单位的Python代码的总运行时间?我知道我可以使用import timetime.time(),但这是假设我的程序至少需要十分之一秒才能运行。如果总执行时间为1毫秒,如何获得代码的总运行时间?

例如:

start_time = time.time()
print("Hello World")
print(time.time() - start_time) # Returns the time in scientific notation.

0 个答案:

没有答案