Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pass variable to thread target

from threading import Thread
from time import sleep
def run(name):
    for x in range(10):
        print("helo "+name)
        sleep(1)
def run1():
    for x in range(10):
        print("hi")
        sleep(1)
T=Thread(target=run,args=("Ayla",))
T1=Thread(target=run1)
T.start()
sleep(0.2)
T1.start()
T.join()
T1.join()
print("Bye")
Comment

PREVIOUS NEXT
Code Example
Python :: python class without init 
Python :: programmation orienté objet python 
Python :: return function in python 
Python :: How to change the title of a console app in python 
Python :: Generate bar plot python 
Python :: np.all 
Python :: 2nd to last index python 
Python :: python print set 
Python :: get first digit of number 
Python :: different types f python loops 
Python :: set time complexity python 
Python :: add title to tkinter window python 
Python :: channels_redis 
Python :: python gui framework 
Python :: delete content of table django 
Python :: python string lenght 
Python :: matlab .* operator in python 
Python :: circular dependencies in python 
Python :: django import could not be resolved 
Python :: zip() python 
Python :: handling timezone in python 
Python :: numpy argsort 
Python :: tensorflow Dense layer activatity leaklyrelu 
Python :: nan vs nat pandas 
Python :: api testing python 
Python :: python append value to column 
Python :: Replace an item in a python list 
Python :: plt.hist bins 
Python :: full form of api 
Python :: getting current user in django 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =