Python : Basic countdown timer & function() > int()

前端 未结 3 719
温柔的废话
温柔的废话 2021-01-26 03:04

I\'m trying to ucreate a timer function that runs in the background of my code and make it so I can use/check the time. What I mean by use/check, I\'m trying to make it so I can

3条回答
  •  悲&欢浪女
    2021-01-26 03:19

    import time
    
    def timer(tim):
        time.sleep(1)
        print tim
    
    def hall():
        tim = 15
        while (tim > 0):
            print 'do something'
            timer(tim)
            tim-=1
    

    Not the cleanest solution, but it will do what you need.

提交回复
热议问题