python导出数据为csv文件。
代码:
复制代码 代码示例:
#!/bin/python
#
import csv
with open('jbxue.csv', 'wb') as csvfile:
#spamwriter = csv.writer(csvfile, delimiter=' ',quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamwriter = csv.writer(csvfile, dialect='excel')
spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])
spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])