askcompu

Untitled

Apr 2nd, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. def duration(seconds, _maxweeks=99999999999):
  2.     return ', '.join('%d %s' % (num, unit)
  3.              for num, unit in zip([(seconds // d) % m
  4.                        for d, m in ((604800, _maxweeks),
  5.                                                         (86400, 7), (3600, 24),
  6.                                                         (60, 60), (1, 60))],
  7.                       ['wk', 'd', 'hr', 'min', 'sec'])
  8.              if num)
Advertisement
Add Comment
Please, Sign In to add comment