import datetime start = datetime.datetime.now() --- --- end = datetime.datetime.now() print (end-start)