How get hours:minutes
问题 I have a script here (not my own) which calculates the length of a movie in my satreceiver. It displays the length in minutes:seconds I want to have that in hours:minutes What changes do I have to make? This is the peace of script concerned: if len > 0: len = "%d:%02d" % (len / 60, len % 60) else: len = "" res = [ None ] I already got the hours by dividing by 3600 instead of 60 but can't get the minutes... Thanks in advance Peter 回答1: You can use timedelta from datetime import timedelta str