I have a list of document pages with indicators where each document begins "ND":
Page1,ND
Page2,
Page3,
Page4,ND
Page5,
I am trying to format it so that I have a two column csv with the first and last page:
Page1, Page3
Page4, Page5
etc
I cannot get beyone a simple loop to identify the first document:
for i in mylist:
if 'ND' in i:
print i
else:
pass
I would like to know what methods are out there to print the line with the ND, then print the line before the next line with the ND and then move on.