用python获取当前时间下一秒

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_42216441/article/details/80488713

编写软件pyCharm


import time
time1 = time.time()
lt = time.localtime(time1)
timeStr = time.strftime("%X",lt)
print(timeStr)
timeList = timeStr.split(":")
shi = int(timeList[0])
fen = int(timeList[1])
miao = int(timeList[-1])
miao += 1
if miao == 60:
     miao = 0
    fen += 1
    if fen == 60:
         fen = 0
         shi += 1
         if shi == 24:
             shi = 0
 print("%.2d:%.2d:%.2d"%(shi,fen,miao))

展开阅读全文

没有更多推荐了,返回首页