>>> # pip install python-dateutil >>> from dateutil import parser >>> dt = parser.parse('144345.20) >>> print(dt) 2016-12-07 14:43:45.200000 >>> dt.hour 14
Quote:so I am trying to get it into a format where I can subtract the start time from the end time to give a run time, but I can't work out how to do it.
Something like this?
import time def time_code(): start = time.clock() time.sleep(5) end = time.clock() print('Code time {:.2f} seconds'.format(end - start)) time_code() # Code time 5.00 secondsThere also timeit that is used to measure code.