# coding: utf-8

import csv

csvfile = open('csv.csv', 'wb')  #打开方式还可以使用file对象
writer = csv.writer(csvfile)
writer.writerow(['姓名', '年龄', '电话']) data = [
('小河', '', ''),
('小芳', '', '')
]
writer.writerows(data) csvfile.close()

用python导出csv文件-LMLPHP

05-11 15:18