I have a large text file that has values separated by a header starting with "#". If the condition matches the condition in the header, I would like to read the file until the next header "#" and the rest of the SKIP file.
To verify that I am trying to read the following text file called test234.txt:
1fnrnf
mrkfr
nfoiernfr
nerfnr
njndjen kj
ejkndjke
The code I wrote is:
file_t = open('test234.txt')
cond = True
while cond:
for line_ in file_t:
print(line_)
if file_t.read(1) == "#":
cond = False
file_t.close()
But the output that I get is:
fnrnf
rkfr
foiernfr
erfnr
something
jndjen kj
jkndjke
vcrvr
Instead, I would like to get output between two headers separated by "#", which:
1fnrnf
mrkfr
nfoiernfr
nerfnr
How can i do this? Thank!
EDIT: python , , , , , , "#", .