Python基础 时间 下一秒

timeStr = input()timeList = timeStr.split(":")h = int(timeList[0])m = int(timeList[1])s = int(timeList[2])s += 1if s == 60: m += 1s = 0if m == 60: h += 1m = 0if h == 24:...
timeStr = input()

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))
  • 发表于 2021-02-23 20:37
  • 阅读 ( 231 )

0 条评论

请先 登录 后评论
阿九
阿九

20 篇文章

作家榜 »

  1. 阿九 20 文章
  2. q5320 14 文章
  3. 不期而遇 8 文章
  4. admin 7 文章
  5. 此心安處是吾鄉 4 文章
  6. 小白 4 文章
  7. Mr.Pang 3 文章
  8. yixinBC 3 文章