[Tutor] csv manipulation

Kent Johnson kent37 at tds.net
Fri Oct 31 15:02:32 CET 2008


On Fri, Oct 31, 2008 at 9:32 AM, Serdar Tumgoren <zstumgoren at gmail.com> wrote:
>> Below is my code. Can someone tell me how I'm botching the use of the
>> "writerows" method? Also, on a separate note, is it possible and necessary
>> to close the input and output files when using csv module? I keep getting a
>> "module has no close method" error when I try to close the files...

Use writerow() not writerows() - you are writing a single row.

To close the files you have to keep a reference to the underlying
file. See my original example.

Kent


More information about the Tutor mailing list