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:
>>> import datetime >>> str(datetime.timedelta(seconds=666)) '0:11:06'