Iam using Linux and  Python 2.7  and playing with the threading.Timer module.

I had the below question on the same.

(a) How to I prevent the execution  the  "EXECUTED SLEEP" after 4
seconds ? , current this is running in an infinite loop

node-1# cat  file_01.py

import threading
import time
def printit():
        threading.Timer(2, printit).start()
        print "EXECUTED SLEEP"
printit()
print "hi"
time.sleep(4)
print "hi"
time.sleep(5)

Output:
node-1# python  file_01.py
EXECUTED SLEEP
hi
EXECUTED SLEEP
EXECUTED SLEEP
EXECUTED SLEEP



Regards,
Ganesh
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to