[Tutor] writing csv files

Sander Sweers sander.sweers at gmail.com
Sat May 22 10:49:25 CEST 2010


On 22 May 2010 09:46, prasad rao <prasadaraon50 at gmail.com> wrote:
>  csvw=csv.writer(open('/home/prasad/kkm','w'),
> dialect='excel',fieldnames=names)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> TypeError: 'fieldnames' is an invalid keyword argument for this function

fieldnames is part of the dictreader and dictwriter objects and you
use the writer object. See the online docs [1] for more info.

Greets
Sander

[1] http://docs.python.org/library/csv.html#csv.DictWriter


More information about the Tutor mailing list