编程语言
首页 > 编程语言> > python 时间下一秒

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))

标签:2d,%.,python,timeStr,60,timeList,一秒,int,时间
来源: https://www.cnblogs.com/pygo/p/12244777.html