Pretty Print Time Difference in Python
First, to measure time, you can use:
import time
import datetime
start = time.perf_counter()
# ... some work ...
end = time.perf_counter()
duration = end - start
To pretty print time, use the following:
print(str(datetime.timedelta(seconds=duration)))
which displays something like 1:14:13
(hours:minutes:seconds).
Thanks! You can always email me or use contact form for more questions/comments etc.