Python timer countdown

后端 未结 7 817
南方客
南方客 2021-01-16 13:06

I want to know about timer in Python.

Suppose i have a code snippet something like:

def abc()
   print \'Hi\'  
   print \'Hello\'
   print \'Hai\'
<         


        
7条回答
  •  不知归路
    2021-01-16 14:12

    You should look into time.sleep(). For example:

    for i in xrange(5):
      abc()
      time.sleep(3)
    

    That will print your lines 5 times with a 3 second delay between.

提交回复
热议问题