I have a function that returns information in seconds, but I need to store that information in hours:minutes:seconds.
Is there an easy way to convert the seconds to this format in Python?
Advertisement
Answer
You can use datetime.timedelta
function:
JavaScript
x
4
1
>>> import datetime
2
>>> str(datetime.timedelta(seconds=666))
3
'0:11:06'
4