python定时器代码,如下:
 
复制代码 代码示例:
#!/usr/bin/env python  
#coding=utf-8
#edit: www.jb200.com
#
import threading  
def sayhello():  
    print "hello world"  
    global t        #Notice: use global variable!  
    t = threading.Timer(5.0, sayhello)  
    t.start()  
  
t = threading.Timer(5.0, sayhello)  
t.start()