python 定时器

 

2s启动一个定时器:

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"])
    timer.start()

 

posted @ 2019-03-28 19:33  anobscureretreat  阅读(384)  评论(0编辑  收藏  举报