I have 2 for loops inside of a with open statement. The first for loop runs perfectly, but it seems that the 2nd for loop is not ran. Sample code below. Can someone explain why the second for loop is skipped over?
with open(data, 'r') as csvFile:
csvReader = csvReader.csvreader(csvFile, delimiter = ',')
counter1 = 0
for row in csvReader:
counter1 = counter1 + 1
print(counter1)
counter2 = 0
for row in csvReader:
counter2 = counter2 + 1
print(counter2)
I know how to write the above code as a single for loop, however I cannot figure out why the second for loop is being ignored. Any suggestions would be much appreciated. Thanks!