Python 定时器 timer

来源:互联网 发布:java wait 区别 编辑:程序博客网 时间:2024/05/16 23:36

Python 定时器 timer

分类: Python 55人阅读 评论(0)收藏 举报
[python] view plaincopy
  1. #!/usr/bin/env python  
  2. #coding=utf-8  
  3. import threading  
  4. def sayhello():  
  5.     print "hello world"  
  6.     global t        #Notice: use global variable!  
  7.     t = threading.Timer(5.0, sayhello)  
  8.     t.start()  
  9.   
  10. t = threading.Timer(5.0, sayhello)  
  11. t.start()  
原创粉丝点击