[Tutor] time taken to execute certain task

Alan Gauld alan.gauld at btinternet.com
Thu Mar 17 09:57:11 CET 2011

"tee chwee liong" <tcl76 at hotmail.com> wrote

> i would like to know the time taken to execute a 
> certain task in python. i used time.time and time.clock 
> and i see the time taken is different? 
> what is the right method to use? 

Neither of those, either use timeit() or the Python profiler.
They are both specifically provided for timing things in your code.

Search the documentation for help with both.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list