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
Inspired by sverrir-sigmundarson's comment:
def time_to_sec(time_str): return sum(x * int(t) for x, t in zip([1, 60, 3600], reversed(time_str.split(":"))))