Seconds7

Convert seconds to compound duration
import sys sec=int(sys.argv[1]) def dur(sec): t=[] for dm in (60,60,24,7): sec, m=divmod(sec,dm) t.append(m) t.append(sec) return ', '.join('%d %s' % (num,unit)                     for num, unit in zip(t[::-1], 'wk d hr min sec'.split)                      if num) print ("%7d seconds = %s" % (sec,dur(sec)))
 * 1) !/usr/bin/python