Are there any alternatives to the code below:
startFromLine = 141978 # or whatever line I need to jump to urlsfile = open(filename, 'rb', 0) linesCounter = 1 for line in urlsfile: if linesCounter > startFromLine: DoSomethingWithThisLine(line) linesCounter += 1
If I’m processing a huge text file (~15MB) with lines of unknown but different length, and need to jump to a particular line which number I know in advance? I feel bad by processing them one by one when I know I could ignore at least first half of the file. Looking for more elegant solution if there is any.
linecache: