Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- def convert_time_to_sec(time):
- # validate format
- if time == '':
- time = '00:00:00'
- time_to_array = re.split(':', time)
- hours = float(time_to_array[0]) * 60. * 60.
- minutes = float(time_to_array[1]) * 60.
- seconds = float(time_to_array[2])
- total_time = hours + minutes + seconds
- return total_time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement