Created
March 30, 2015 10:59
-
-
Save afaquejam/b899ea8ad5e40cad31aa to your computer and use it in GitHub Desktop.
Threading in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
def worker(num, squre): | |
print ("Worker number: " + str(num)) | |
print ("Squre of the thread number is " + str(squre)) | |
time.sleep(2) | |
print threading.currentThread().getName() | |
return | |
for i in range(5): | |
t = threading.Thread(name='hey', target = worker, args=(i, i**2)) | |
t.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment