Python timer countdown

后端 未结 7 812
南方客
南方客 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.

    0 讨论(0)
提交回复
热议问题