标签:spi 过多 对象 thread 设定 threading 简单 run 浮点数
1 import time 2 import sched 3 4 schedule = sched.scheduler( time.time,time.sleep) 5 6 def func(string1): 7 print "now excuted func is %s"%string1 8 9 print "start" 10 schedule.enter(2,0,func,(1,)) 11 schedule.enter(2,0,func,(2,)) 12 schedule.enter(3,0,func,(3,)) 13 schedule.enter(4,0,func,(4,)) 14 schedule.run() 15 16 print "end"
1 import time 2 import sched 3 from threading import Timer 4 def print_name(str): 5 print "i‘m %s"%str 6 print "start" 7 Timer(5,print_name,("superman",)).start() 8 Timer(10,print_name,("spiderman",)).start() 9 print "end"
标签:spi 过多 对象 thread 设定 threading 简单 run 浮点数
原文地址:https://www.cnblogs.com/ArmoredTitan/p/9138509.html