1

How can I find the total runtime of my Python code in milliseconds? I know I can use import time and time.time() but that is assuming that my program takes at least a tenth of a second to run. How can I get the total runtime of the code if the total execution time is 1 millisecond?

For Example:

start_time = time.time()
print("Hello World")
print(time.time() - start_time) # Returns the time in scientific notation.
Hasnain Ali
  • 432
  • 1
  • 4
  • 12

0 Answers0