Simple csv read/write

John Machin sjmachin at
Tue Apr 24 20:35:19 EDT 2007

On 25/04/2007 8:27 AM, Drew wrote:
> Ok, I'm trying to do the simplest read/write from one csv file to
> another. For some reason, every other row on the output file is a
> blank row. What am I doing wrong?
> import csv
> reader = csv.reader(open('current.csv'))
> writer = csv.writer(open('new.csv','w'))
> for line in reader:
>     writer.writerow(line)

1. Try reading the responses already posted to your previous questions.

2. Try reading the documentation; for each of csv.reader and csv.writer, 
it says "If csvfile is a file object, it must be opened with the 'b' 
flag on platforms where that makes a difference."

More information about the Python-list mailing list