每次读取4K,读完为止:
src_f1 = './test1.html'
dst_f2 = './test2.html'
src_fobj = open(src_f1,'rb')
dst_fobj = open(dst_f2,'wb')
while True:
data = src_fobj.read(4096)
if not data:
break
dst_fobj.write(data)
src_fobj.close()
dst_fobj.close()
每次读取4K,读完为止:
src_f1 = './test1.html'
dst_f2 = './test2.html'
src_fobj = open(src_f1,'rb')
dst_fobj = open(dst_f2,'wb')
while True:
data = src_fobj.read(4096)
if not data:
break
dst_fobj.write(data)
src_fobj.close()
dst_fobj.close()