I have a Sqlite 3 and/or MySQL table named \"clients\"..
Using python 2.6, How do I create a csv file named Clients100914.csv with headers? excel dialect...
Using the csv module is very straight forward and made for this task.
import csv
writer = csv.writer(open("out.csv", 'w'))
writer.writerow(['name', 'address', 'phone', 'etc'])
writer.writerow(['bob', '2 main st', '703', 'yada'])
writer.writerow(['mary', '3 main st', '704', 'yada'])
Creates exactly the format you're expecting.