Measuring the Time Taken For Code to Execute

Python

 1|  from time import time
 2|  
 3|  start_time = time()
 4|  
 5|  #Replace with code to execute...
 6|  
 7|  print('Elapsed Time: {:.3f} seconds'.format(time() - start_time))
Did you find this snippet useful?

Sign up for free to to add this to your code library