Issue with CSV

Harry George harry.g.george at boeing.com
Thu Jul 19 01:10:22 EDT 2007


Rohan <vodela.sai at gmail.com> writes:

> Hello,
> I'm working on a script which collects some data and puts into a csv
> file which could be exported to excel.
> so far so good, I'm able to do what I described.
> When I run the script for the second time after a certain period of
> time the results should appear next to the results of the last run,
> I'm unable to make a new column when the script is run after the first
> time.
> Ideally I would like to have an output which looks like this.
> 1/20       1/27
> we.py    we.py
> gh.py    gj.py   <- Indicating tht the file has changed
> fg.py    fg.py
>
> Please help me out.
> Thanks
>

We'd need to see code to tell what you are doing wrong.   The solution is pretty obvious:   

1. Model the needed structure, which is a 2D matrix of script x date.
Assuming the above output is the nromal case, this can be done with a
list of rows, each of which has a list of entries by date.

2. Write reader code which reads a csv and loads it into this structure.

3. Write writer code which writes this structure out to csv.

4. Write orchestration code to a) read the old csv, b) check the
loaded structure's data against the new data-on-disk to find changed
files, c) update the structure appropriately, d) write out the
resulting new csv.

-- 
Harry George
PLM Engineering Architecture



More information about the Python-list mailing list