I have file
Header 1
line 1
line 2
line 3
line 4
Header 2
line 1
line 2
line 3
line 4
I want to read Header 1 then read line 3 and 4 below it, after that I want to read Header 2 then read line 3 and 4 below it in different context. The string for searching line 3 and 4 in both cases is the same, but lines are not completely same. Presently I am searching for header 1 using
for line in file
if "Header 1" in line:
I am not able to use readline inside for loop of this file to read a block of 4 lines.
Store all the lines, then analyze them:
That will make it easy to jump between lines as required, which is not true when reading straight from a file.