• Timer:定时调用函数

例子1:

import threading
import time

def hello(name):
    print ("hello %s\n" ) % name
    global timer
    timer = threading.Timer(2.0, hello, ["Hawk"])
    timer.start()

if __name__ == "__main__":
    timer = threading.Timer(2.0, hello, ["Hawk"])   ##每隔两秒调用函数hello
    timer.start()
 

 

相关文章:

  • 2022-12-23
  • 2021-06-14
  • 2021-05-20
  • 2021-08-14
  • 2021-06-26
  • 2022-01-18
  • 2022-03-07
猜你喜欢
  • 2022-01-28
  • 2023-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2021-06-18
相关资源
相似解决方案