每次读取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()
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。