from Make 2 functions run at the same time by using thread. It can make two function with the same time. Is it possible to call function with thread in try except block?
import threading
from threading import Thread
import time
def queryRepeatedly():
while True:
while True:
try:
Thread(target = foo).start()
Thread(target = bar).start()
print ''
except:
continue
else:
break
def foo():
print 'foo'
time.sleep(1)
def bar():
print 'bar'
time.sleep(3)
queryRepeatedly()
This my code not work,i need to run two function separately with try except block. what should i do?