线程示例(1)
最简单的多线程:线程类似和室友分享图书:(页数,行数,字的位置)
ex1:
1 import threading 2 import time 3 4 def run(n): 5 print("threading",n) 6 time.sleep(3) 7 8 t1=threading.Thread(target=run,args=("t1",)) 9 t2=threading.Thread(target=run,args=("t2",)) 10 # t1.start() 11 # t2.start() 12 run("t1") 13 run("t2")