import os,time
from multiprocessing import Pool
def copyFile(rPath,wPath):
    fr = open(rPath,"rb")
    fw = open(wPath,'wb')
    context = fr.read()
    fw.write(context)
    fr.close()
    fw.close()

srcpath = r"/Users/admin/Documents/python/9.线程于进程/2.进程/file"
topath = r"/Users/admin/Documents/python/9.线程于进程/2.进程/tofile"

#读取path下的所有文件
filesList = os.listdir(srcpath)
#启动for循环处理每一个文件
start = time.time()
for fileName in filesList:
    copyFile(os.path.join(srcpath,fileName),os.path.join(topath,fileName))

end = time.time()
print("总耗时： %0.2f" % (end-start))
251cc4f40f583b6bc8a53e1e2e5dd2c9646ae4fd
<mask token>


def copyFile(rPath, wPath):
    fr = open(rPath, 'rb')
    fw = open(wPath, 'wb')
    context = fr.read()
    fw.write(context)
    fr.close()
    fw.close()


<mask token>

<mask token>


def copyFile(rPath, wPath):
    fr = open(rPath, 'rb')
    fw = open(wPath, 'wb')
    context = fr.read()
    fw.write(context)
    fr.close()
    fw.close()


<mask token>
for fileName in filesList:
    copyFile(os.path.join(srcpath, fileName), os.path.join(topath, fileName))
<mask token>
print('总耗时： %0.2f' % (end - start))

<mask token>


def copyFile(rPath, wPath):
    fr = open(rPath, 'rb')
    fw = open(wPath, 'wb')
    context = fr.read()
    fw.write(context)
    fr.close()
    fw.close()


srcpath = '/Users/admin/Documents/python/9.线程于进程/2.进程/file'
topath = '/Users/admin/Documents/python/9.线程于进程/2.进程/tofile'
filesList = os.listdir(srcpath)
start = time.time()
for fileName in filesList:
    copyFile(os.path.join(srcpath, fileName), os.path.join(topath, fileName))
end = time.time()
print('总耗时： %0.2f' % (end - start))

import os, time
from multiprocessing import Pool


def copyFile(rPath, wPath):
    fr = open(rPath, 'rb')
    fw = open(wPath, 'wb')
    context = fr.read()
    fw.write(context)
    fr.close()
    fw.close()


srcpath = '/Users/admin/Documents/python/9.线程于进程/2.进程/file'
topath = '/Users/admin/Documents/python/9.线程于进程/2.进程/tofile'
filesList = os.listdir(srcpath)
start = time.time()
for fileName in filesList:
    copyFile(os.path.join(srcpath, fileName), os.path.join(topath, fileName))
end = time.time()
print('总耗时： %0.2f' % (end - start))

import os,time
from multiprocessing import Pool
def copyFile(rPath,wPath):
    fr = open(rPath,"rb")
    fw = open(wPath,'wb')
    context = fr.read()
    fw.write(context)
    fr.close()
    fw.close()

srcpath = r"/Users/admin/Documents/python/9.线程于进程/2.进程/file"
topath = r"/Users/admin/Documents/python/9.线程于进程/2.进程/tofile"

#读取path下的所有文件
filesList = os.listdir(srcpath)
#启动for循环处理每一个文件
start = time.time()
for fileName in filesList:
    copyFile(os.path.join(srcpath,fileName),os.path.join(topath,fileName))

end = time.time()
print("总耗时： %0.2f" % (end-start))