I have a python script that gets data from a database and outputs a csv file. Now I'm trying to add a header row containing titles for each of the columns. What do I need to add so that it outputs an initial row ahead of the db output (I'm qui开发者_开发技巧te a newbie to python, so I got stuck in this part and couldn't find the info I needed)?
Thanks in advance!
If you're using a DictWriter
, you can just call writeheader
.
精彩评论