Skip to content

Measure Code Execution Time

How to use time object for code execution time in Python.

import time

#get starting time
start = time.time()

#codes which you want to measure execution time
for i in range(1, 100000):
    print("")

#get ending time
end = time.time()

print("Total execution time of codes is ", end - start)
Published inPython

Be First to Comment

Leave a Reply

%d bloggers like this: