CSV Reader

Larry Bates larry.bates at websafe.com
Mon Feb 11 10:53:04 EST 2008


Mike P wrote:
> Hi All,
> 
> I want to read in a CSV file, but then write out a new CSV file from a
> given line..
> 
> I'm using the CSV reader and have the the line where i want to start
> writing the new file from begins with
> "Transaction ID",
> 
> i thought it should be something along the lines of below.. obvioulsy
> this doesn't work but any help would be great.
> 
> import csv
> f = file(working_CSV, 'rb')
> new_data = 0  # a counter to find where the line starts with
> "Transaction ID"
> reader = csv.reader(f)
> for data in reader:
>     read data file
> 
> write new CSV
> 
> Cheers
> 
> Mike
> 
What part "obviously" doesn't work?  Try something, post any tracebacks and we 
will try to help.  Don't ask others to write your code for you without actually 
trying it yourself.  It appears you are on the right track.

-Larry



More information about the Python-list mailing list