I have a huge text file from which i want to selectively read a few lines.
Using tell() i know the positions i want to read between.
Is there a way i can read all the text in the file between the two positions?
like file.read(beginPos, endPos)
or maybe, read all text between line number containing beginPos and line number containing endPos?
If you now the start point (with
tell()) and the end point, you could simply do afile.read(end-start), it will read theend-startbytes. If you’re not at the correct offset on begining, use the seek() method (file.seek(start)) first.