开发者

python adding a title row to csv output file

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜