Which Python datetime or time method should I use to convert time in HH:MM:SS to decimal time in seconds? The times represent durations of time (most are less than a minute) and are not connected to a date.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
If by "decimal time" you mean an integer number of seconds, then you probably want to use
datetime.timedelta
:(If you actually wanted a
Decimal
, of course, it's easy enough to get there...)Using the
datetime
module: