Bill Reason Bill Reason - 1 year ago 95
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 Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download