<filename>99-Python_Miscellaneous/python_seek.py<gh_stars>0
fp = open('abcd.txt', 'r')

line_offset = []
offset = 0
for line in fp:
    line_offset.append(offset)
    offset += len(line)
print(line_offset)
for each in line_offset:
    fp.seek(each)
    print(fp.readline()[:-1])

<filename>99-Python_Miscellaneous/python_seek.py<gh_stars>0
fp = open('abcd.txt', 'r')

line_offset = []
offset = 0
for line in fp:
    line_offset.append(offset)
    offset += len(line)
print(line_offset)
for each in line_offset:
    fp.seek(each)
    print(fp.readline()[:-1])
