import time start = time.time() #the rest of your code print '{0:.2f} seconds elapsed.'.format(time.time()-start)