Calculate how many time spend any code to run
from datetime import datetime
import os
""" in first line of body script """
# current time
tic = datetime.now()
""" in last line of body script """
# calculate time of processing
toc = datetime.now()
tictoc = ((toc-tic).total_seconds())/60. # minutes
print ("\nProcess start: %s"%tic)
print ("Process finish: %s"%toc)
print ("Process time spent %s minutes"%tictoc)
# notification
os.system('notify-send "THE END" "The process was over!!!\nIt spent %s minutes.\nHAVE A GOOD DAY..."'%tictoc)
print ("\n--- The End ---")
quit()