标签:join 线程进程 mat threading def async 文件 print tar
import threading
import asyncio
import time
def copy(src,tar):
print('{} start...'.format(threading.current_thread().name))
with open(src,'rb') as binFileInputStream:
with open(tar,'wb') as binFileOutputStream:
binFileOutputStream.write(binFileInputStream.read())
time.sleep(10)
print('{} end...'.format(threading.current_thread().name))
threads = []
args = [('./test.py','./hella.py'),('./diabetes.csv','./diabetes.py')]
for i,arg in enumerate(args):
t = threading.Thread(target=copy,args=arg,name='thread-{}'.format(i))
threads.append(t)
for thread in threads:
thread.start()
for thread in threads:
thread.join()
标签:join 线程进程 mat threading def async 文件 print tar
原文地址:https://www.cnblogs.com/Frank99/p/9831622.html