线程示例(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")

 

posted on 2017-11-06 23:28  Alan_chow  阅读(110)  评论(0编辑  收藏  举报

导航