How to measure time elapsed in Python. | DzQ39 |

This is a quick summary of how to measure time elapsed in Python.

Code

from timeit import default_timer as timer
import time # needed to support sleep.

start = timer()
time.sleep(5) # delay 5 seconds
end = timer()
print(end - start)



Result


Reference:

Measure time elapsed in Python?
http://stackoverflow.com/questions/7370801/measure-time-elapsed-in-python
Share on Google Plus

About Tac tamma

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment