I need to convert time value strings given in the following format to seconds, for example:
1.\'00:00:00,000\' -> 0 seconds 2.\'00:00:10,000\' -> 10 s
It looks like you're willing to strip fractions of a second... the problem is you can't use '00' as the hour with %I
%I
>>> time.strptime('00:00:00,000'.split(',')[0],'%H:%M:%S') time.struct_time(tm_year=1900, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1) >>>