python(threading 多线程模块 直接调用)

# Author:Sooele

import threading   #线程模块
import time

def run(n):
    print("task",n)
    time.sleep(2)
t1 = threading.Thread(target=run,args=("t1",))
t2 = threading.Thread(target=run,args=("t2",))
t1.start()
t2.start()

# run("t1")
# run("t2")

发表评论