import csv

 
fieldnames = ['Column1''Column2''Column3''Column4']
rows = [{'Column1''0''Column2''1''Column3''2''Column4''3'},
{'Column1''0''Column2''1''Column3''2''Column4''3'},
{'Column1''0''Column2''1''Column3''2''Column4''3'},
{'Column1''0''Column2''1''Column3''2''Column4''3'},
{'Column1''0''Column2''1''Column3''2''Column4''3'}]
dict_writer = csv.DictWriter(file('your.csv''wb'), fieldnames=fieldnames)
dict_writer.writeheader() # 这里写header
dict_writer.writerows(rows) # rows就是表单需要写到csv文件的数据
05-07 12:51