Python Forum
CSV files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: CSV files (/thread-16991.html)



CSV files - PythonNoob99 - Mar-23-2019

Hello everybody,

I have a problem. I have a CSV file and I use this file in my program. From my output I make a new csv file but I would like to use this output again as input for 100 times. For example i want to see the 50th simulation. So the same csv file has to update.
I thought to make a for loop f.e: my input is L and the output is C. But I don’t know how to integrate this in the loop. Someone some tips/help?

Thank you all.


RE: CSV files - ichabod801 - Mar-23-2019

Are you saying you want to see all the results for each generation in the csv file? I would read the file in before the loop. Then at the end of each loop, write the output file in 'a' mode (appends to the file) without headers (so they don't repeat).


RE: CSV files - PythonNoob99 - Mar-23-2019

No, I have an csv as input and a new one as output but now I want tobuse the output as input and then agian and agian and I want to know the 50th output for example.


RE: CSV files - Larz60+ - Mar-23-2019

Quote:No, I have an csv as input and a new one as output but now I want tobuse the output as input and then agian and agian and I want to know the 50th output for example.
This is difficult to understand. Please show step by step pseudo code.