how to running time of code in python code example
Example 1: find time of run for python code
import time
start_time = time.time()
main()
print("--- %s seconds ---" % (time.time() - start_time))
Example 2: python - time of execution
import time
from datetime import timedelta
start_time = time.monotonic()
# do your work here
end_time = time.monotonic()
print(timedelta(seconds=end_time - start_time))