Bill Reason Bill Reason - 1 month ago 14
Python Question

Is there a way to time things in Python?

Is there a way to time the amount of time that happened between (for example) button a being pressed and button b being pressed in Python? If so, how?

Thanks for any help.

am2 am2
Answer

You dislike to search before ask, isnt't it? there is a module surprisingly called time

import time
start = time.time()
for i in range(10):
    print i
stop = time.time()
print 'elapsed time in seconds', stop - start
Comments