python中的线程提供了java线程功能的子集。
#!/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'
#!/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'