python 时间下一秒

timeStr = input()

#12:23:23

timeList = timeStr.split(":")

h = int(timeList[0])
m = int(timeList[1])
s = int(timeList[2])

s += 1
if s == 60:
m += 1
s = 0
if m == 60:
h += 1
m = 0
if h == 24:
h = 0

print("%.2d:%.2d:%.2d" % (h, m, s))
原文地址:https://www.cnblogs.com/pygo/p/12244777.html