Write to CSV from sqlite3 database in python
You should just do:
rows = c.fetchall()
csvWriter.writerows(rows)
If the reason you iterate through the rows is because you wan't to preprocess them before writing them to the file, then use the writerow
method:
rows = c.fetchall()
for row in rows:
# do your stuff
csvWriter.writerow(row)