thread block python code example
Example 1: python thread function
x = threading.Thread(target=thread_function, args=(1,), daemon=True)
x.start()
# x.join()
Example 2: 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')