Skip to content

Commit 382cfac

Browse files
committed
Adding threads in python.
1 parent 7eefcb8 commit 382cfac

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

threads/thread.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from threading import Thread
2+
import time
3+
4+
def my_func(i):
5+
print('Starting thread %d' %i)
6+
time.sleep(5)
7+
print('Finishing thread %d ' %i)
8+
9+
for i in range(10):
10+
t = Thread(target=my_func, args=(i,))
11+
t.start()

0 commit comments

Comments
 (0)