Skip to content

Instantly share code, notes, and snippets.

@mtik00
Created September 1, 2020 23:03
Show Gist options
  • Save mtik00/d05f7fce0446904160168350a4297353 to your computer and use it in GitHub Desktop.
Save mtik00/d05f7fce0446904160168350a4297353 to your computer and use it in GitHub Desktop.
def format_timespan(seconds: float) -> str:
"""Formats the number of seconds in h:m:s"""
hours, seconds = divmod(seconds, 3600)
minutes, seconds = divmod(seconds, 60)
return f"{hours:d}h:{minutes:02d}m:{seconds}s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment