python多线程
程序员文章站
2022-03-25 16:10:42
#创建线程threading_list = [] t1 = threading.Thread(target=music,args=(u'爱情买卖',)) threading_list.append(t1) t2 = threading.Thread(target=move,args=(u'阿凡达',... ......
#创建线程
threading_list = [] t1 = threading.thread(target=music,args=(u'爱情买卖',)) threading_list.append(t1) t2 = threading.thread(target=move,args=(u'阿凡达',)) threading_list.append(t2)
for t in threading_list: #启动线程
t.setdaemon(true) #将线程声明为守护线程
t.start()
for i in range(len(threading_list)): #等待线程结束
threadding_list[i].join()
上一篇: 编程语言分类