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 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   

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 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?

Thank you!

For simplicity, create the generator: 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

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -