利用divmod实现 seconds=int(input("输入秒数")) m, s = divmod(seconds, 60) h, m = divmod(m, 60) print (f"{h}:{m}:{s}")