37,719
社区成员
发帖
与我相关
我的任务
分享
import time
def sleeptime(hour,min,sec):
return hour*3600 + min*60 + sec;
second = sleeptime(0,0,20);
while 1==1:
time.sleep(second);
print 'do action'
#这是隔20秒执行一次
;
#!/usr/bin/env python
from threading import Timer
import time
timer_interval=1
def delayrun():
print 'running'
t=Timer(timer_interval,delayrun)
t.start()
while True:
time.sleep(0.1)
print 'main running'