text=’’’
frist line
second line
thrid line
end
rrrrrrr
‘’’
font=open(‘tmp1.txt’,‘w’)
size =len(text)
#初始位置
offset= 0
#增量
chunk=100
while offset<size:
font.write(book[offset:offset+chunk])
#初始位置加增量
offset=offset+chunk
font.close()
python初学---分次写文件
最新推荐文章于 2023-12-23 22:06:29 发布