标签: python time
如何找到以毫秒为单位的Python代码的总运行时间?我知道我可以使用import time和time.time(),但这是假设我的程序至少需要十分之一秒才能运行。如果总执行时间为1毫秒,如何获得代码的总运行时间?
import time
time.time()
例如:
start_time = time.time() print("Hello World") print(time.time() - start_time) # Returns the time in scientific notation.