import time
def execution_time(code):
start = time.clock(code)
result = eval(code)
time = time.clock(code) - start
python中估算程序运行时长的代码,非常简洁。 根据运行结果,简单的加法循环,1亿次耗时5秒左右。
import time
def execution_time(code):
start = time.clock(code)
result = eval(code)
time = time.clock(code) - start
python中估算程序运行时长的代码,非常简洁。 根据运行结果,简单的加法循环,1亿次耗时5秒左右。