31-拷贝文件

每次读取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()

猜你喜欢

转载自www.cnblogs.com/hejianping/p/10875507.html
今日推荐