您可能需要看一下该timeit
模块:
http://docs.python.org/library/timeit.html
或profile
模块:
http://docs.python.org/library/profile.html
这里还有一些不错的教程:
http://www.doughellmann.com/PyMOTW/profile/index.html
http://www.doughellmann.com/PyMOTW/timeit/index.html
如何在python中计算程序运行时间?
您可能需要看一下该timeit
模块:
http://docs.python.org/library/timeit.html
或profile
模块:
http://docs.python.org/library/profile.html
这里还有一些不错的教程:
http://www.doughellmann.com/PyMOTW/profile/index.html
http://www.doughellmann.com/PyMOTW/timeit/index.html