iPython 计算运行时间

使用 %timeit 函数即可:

%timeit -n 100 -r 3 x=1

其中 -n 表示语句循环执行的次数,-r 则表示循环执行的次数,最后显示的结果为 r 次循环中循环执行的最短时间。

Previous topic

IPython Cheatsheet

Next topic

Matplotlib Cheatsheet

This Page