二进制复制文件

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

# 适合普通大小文件的复制
def text_write(infilename, outfilename):
    infile = open(infilename, 'r')
    outfile = open(outfilename, 'w')
    for line in infile.readlines():
        print(line, file=outfile, end='')
    print('Done.')

# 适合大数据文件的复制
def buffer_write(infilename, outfilename, buffersize=5000):
    infile = open(infilename, 'rb')
    outfile = open(outfilename, 'wb')
    buffer = infile.read(buffersize)
    while len(buffer):
        outfile.write(buffer)
        print('.', end='')
        buffer = infile.read(buffersize)
    print()
    print('Done.')