1.定时器

 1 import threading
 2 
 3 #定义函数
 4 
 5 def fun_timer():
 6     print('hello timer')   #打印输出
 7     global timer  #定义变量
 8     timer = threading.Timer(1,fun_timer)   #60秒调用一次函数
 9     # #定时器构造函数主要有2个参数,第一个参数为时间,第二个参数为函数名
10     timer.start()    #启用定时器
11 timer = threading.Timer(1,fun_timer)  #首次启动
12 timer.start()
View Code

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2022-02-02
  • 2021-12-18
  • 2022-12-23
  • 2021-09-27
  • 2021-05-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2021-05-10
  • 2021-08-27
  • 2021-09-11
相关资源
相似解决方案