seconds = 15743 m, s = divmod(seconds, 60) h, m = divmod(m, 60) print("{0}:{1:02d}:{2:02d}".format(h, m, s)) 4:22:23