threading.evennt () and thread(target=one) code example
Example 1: how to thread python
import threading, time
def worker():
"""thread worker function"""
print('Worker')
return
threads = []
for i in range(5):
t = threading.Thread(target=worker)
threads.append(t)
t.start()
print('Thread')
Example 2: python threading
def myFunction(x, y):
pass
x = threading.Thread(target=myFunction, args=(x, y))
x.start()