I am trying to copy a specific part of a file to another one. The input file has four lines which start by the same name ("1" in the example given). I don't know exactly how I could take only the part of the file that is between the first "1" and the second "1" (more than 100 lines...):
· · 1 · · · 1 · · · 1
I just started the following:
f_read = open(pathway, "r")
f_write = open(pathway, "w")
cnt = 0
with f_read as f1:
for line in f1:
if line.startswith("1"):
cnt =+ 1
if cnt == 2:
break
And here I do not know how to specify the part of the file I want (from the first "1" until the second "1")...
Any ideas? Thank you in advance!!