我在test.py中编写了这个简单的代码(在python中).我尝试运行timeit,我没有任何错误,但我没有得到任何有关运行时间的信息.你能帮助我吗 ?
import timeit
def functionsWhile():
"Desc about function"
lic = 0
n = 30000
while lic<= n:
lic += 1
#print "test"
return lic
t = timeit.Timer("functionsWhile()", "from __main__ import functionsWhile")
try:
t.repeat(3, 2)
except:
t.print_exc()
Run Code Online (Sandbox Code Playgroud)
我期待一个结果如(例子):
$>python test.py
[0.006793975830078125, 0.006793975830078125, 0.006793975830078125]
$>
Run Code Online (Sandbox Code Playgroud)
但我只有:
$>python test.py
$>
Run Code Online (Sandbox Code Playgroud)
我没有timeit的结果.我使用python 2.7和linux.
| 归档时间: |
|
| 查看次数: |
454 次 |
| 最近记录: |