from threading import Timer
def hello():
print "hello, world"
t = Timer(30.0, hello)
t.start()
This code only fires the timer once.
How can I make the timer run forever?
Thanks,
updated
this is right :
import time,sys
def hello():
while True:
print "Hello, Word!"
sys.stdout.flush()
time.sleep(2.0)
hello()
and this:
from threading import Timer
def hello():
print "hello, world"
sys.stdout.flush()
t = Timer(2.0, hello)
t.start()
t = Timer(2.0, hello)
t.start()