[Python] python通过线程实现定时器timer的代码 →→→→→进入此内容的聊天室

来自 , 2021-03-01, 写在 Python, 查看 106 次.
URL http://www.code666.cn/view/bfc89c3e
  1. import threading
  2. def sayhello():
  3.         print "hello world"
  4.         global t        #Notice: use global variable!
  5.         t = threading.Timer(5.0, sayhello)
  6.         t.start()
  7.  
  8. t = threading.Timer(5.0, sayhello)
  9. t.start()
  10.  
  11.  
  12. #//python/8815

回复 "python通过线程实现定时器timer的代码"

这儿你可以回复上面这条便签

captcha