Python Forum

Full Version: A simple problem, how best to solve it?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This seems quite simple compared to many problems I've had. However, I'm not finding an elegant solution at the moment.

I have two csv files and I'd like to combine them and then write them to another csv file. My problem is that these csv files are constantly being updated and I don't want to miss out on any updates. If I combine a row of data and then save it to another csv file, I might have missed out on further updates to the csv file or I might miss a row of data if several get put into the first csv file at once. However if I simply combine all the rows with the current piece of data, I may have issues saving the new amended data to a csv file. There are various things that can go wrong.

Is there an easy way to do this that I'm not thinking of?
Do the files contain a timestamp? Synchronize on that. Otherwise, there is no synchronization and your combined file is meaningless.
Quote:these csv files are constantly being updated

If everything is constantly updating, you will just need to do this regularly. You will always miss something!

Set a cronjob to run your Python script every hour or whatever.