Hey its a bit hard to explain, but I will try it.
I have a lot of code, which is working with csv and only one line.
I use next(csv_reader)
to get only the first line which I call with
line = next(csv_reader), line[0] #represents the first line
So with the code I get testpath1 and with line[1]
I am getting title1
Here ends the whole programm. But I want to continue with the next testpath2 and title2, so I would try to do next(csv_reader)
and line = next(csv_reader), line[0] #represents the second line
This is how I could get thestpath2/3/4 and so one. But how to prevent the StopIteration Execption which comes up when there is nothing to skip? How I count the rows is clear: row_count = sum(1 for row in csv_reader)
would count my rows. It would be much easier just to rerun the whole code/class but adding this line on top: next(csv_reader)
. I hope my question is clear. Cheers!