#!/usr/bin/python
# -*- coding: utf-8 -*-
file_name='test_file.txt'
curs = []
with open(file_name,'wb') as fw:
for i in range(10):
index_str = 'hello' + str(i*223)
fw.write(index_str.encode('utf-8'))
end = fw.tell()
curs.append ((end, index_str))
print(curs)
with open(file_name, 'rb') as fr:
start = 0
for item in curs:
fr.seek(start)
end = item[0]
content = fr.read(end-start)
start = end
print(content)
输出