I want to target one more function of let say odd number using the same thread Here is my code.
from threading import *
def evenNumber():
print(current_thread().getName())
for x in range(10):
if x%2==0:
print(x," ")
#print(current_thread().getName())
t= Thread(target=evenNumber)
t.start()
You could use something like this:
def even_odd():
evenNumber()
oddNumber()
t= Thread(target=even_odd)
t.start()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.