可能定义继承的类
datetime.timedelta会更加优雅
class mytimedelta(datetime.timedelta): def __str__(self): seconds = self.total_seconds() hours = seconds // 3600 minutes = (seconds % 3600) // 60 seconds = seconds % 60 str = '{}:{}:{}'.format(int(hours), int(minutes), int(seconds)) return (str)td = mytimedelta(hours=36, minutes=10, seconds=10)>>> str(td)prints '36:10:10'


