xdd1997
    def num2HourMinSec(num):
        m, s = divmod(num, 60)
        h, m = divmod(m, 60)
        timestr = "%02d:%02d:%02d" % (h, m, s)
        return timestr
import time
for i in range(121):   #120秒倒计时,这里121可以是变量,替换称所需要的数据就可用制作成任意时间的倒计时了,我一般用这个倒计时做自动化运行的一个脚本
    seconds = 120 - i
    time.sleep(1)
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    print ("\r剩余%02d时%02d分%02d秒" % (h, m, s),end="")

 

分类:

技术点:

相关文章:

  • 2021-11-25
  • 2021-12-18
  • 2022-02-15
  • 2021-07-25
  • 2021-12-26
  • 2021-12-18
  • 2021-12-31
  • 2021-12-26
猜你喜欢
  • 2021-11-26
  • 2021-12-18
  • 2021-12-26
  • 2021-12-26
  • 2021-12-06
  • 2021-12-26
  • 2021-12-18
相关资源
相似解决方案