線程學(xué)習(xí):(步驟)
import threading
?
threads=[] /創(chuàng)建數(shù)組
t1 = threading.Thread(group=None,target=None,name=None,args=(),kwargs={})
threads.append(t1)
for循環(huán)便利數(shù)組
for t in threads:
?
?t.setDaemon(True) / 聲明守護(hù)線程
?t.start() /開始線程活動
注:父線程結(jié)束,子線程直接終止
添加 join()方法 用于等待子線程結(jié)束