python - How do I go to the first record of a CSV file within the same "for" loop? -
I asked a similar question and the answer I get is However, I have CSV within the same for the loop < I want to navigate the first record of / strong>. I know that my loop will not end those methods, but it's fine what I want. I do not think the Thank you! For simplicity, create the generator: seek () the way. Now I am doing the following:
Input as Open ("total.csv", 'rb') 1: time.sleep (3) input1.seek (0) reader = csv For the line in the reader: reader (input 1, delimiter = "\ t"): read the CSV row by # line
for loop ends and if it reaches the final record, then I want to navigate the first record and read the whole file again (and read it). How do I do that?
def repe_reader (Input , Reader): While correct: input.seek (0) for the line in the reader: output row with open ("total.csv", 'rb') as input 1: reader = csv.reader (input 1, delimiter = "\ t") is repeated (Input 1, Reader): Read the CSV row by # line.
Comments
Post a Comment