Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from threading import Thread
- n = 5
- def foobar():
- print('foobar')
- def threads(n):
- for n in range(n):
- yield Thread(target=foobar)
- thread_list = list()
- for thread in threads(n):
- thread_list.append(thread)
- for thread in thread_list:
- thread.start()
- for thread in thread_list:
- thread.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement