-4

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.

Bill Reason
  • 321
  • 5
  • 11

2 Answers2

2

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
am2
  • 370
  • 5
  • 20
1

You can use the time function

import time

start = time.time()
#do stuff
end = time.time()
logger.debug("time:{0}".format(end-start))
Don Smythe
  • 8,096
  • 14
  • 58
  • 100