def get_sec(time_str):
"""Get seconds from time."""
h, m, s = time_str.split(':')
return int(h) * 3600 + int(m) * 60 + int(s)
print(get_sec('1:23:45'))
print(get_sec('0:04:15'))
print(get_sec('0:00:25'))
More Related Contents:
- How to sum all range output in python 3
- How to map dict into another dict Python
- ImportError: Cannot import name X
- Matplotlib different size subplots
- join list of lists in python [duplicate]
- Can pandas automatically read dates from a CSV file?
- Pandas cannot open an Excel (.xlsx) file
- How to determine the length of lists in a pandas dataframe column
- Pandas fill missing values in dataframe from another dataframe
- What is the time complexity of popping elements from list in Python?
- How can I generate a list of consecutive numbers?
- Why compile Python code?
- Spark union of multiple RDDs
- Python sqlite3 and concurrency
- argparse subparser monolithic help output
- Return a list of imported Python modules used in a script?
- How can I modify a Python traceback object when raising an exception?
- >> operator in Python
- Python selenium: wait until element is clickable – not working
- “TypeError: method() takes 1 positional argument but 2 were given” but I did only pass one
- How to stop the input function from inserting a new line?
- Grep and Python
- Changing one dict changes all dicts in a list of dicts [duplicate]
- How to start threads at the same time in Python [duplicate]
- Regexp to remove specific number of occurrences of character only
- QuerySet, Object has no attribute id – Django
- Region of Interest opencv python
- Binary buffer in Python
- pygame error, No video mode has been set
- Multi Index Sorting in Pandas