📜  将变量传递给线程目标 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:21.341000             🧑  作者: Mango

代码示例2
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")