# coding: utf-8 import csv csvfile = open(‘csv.csv‘, ‘wb‘) #打开方式还可以使用file对象 writer = csv.writer(csvfile) writer.writerow([‘姓名‘, ‘年龄‘, ‘电话‘]) data = [ (‘小河‘, ‘25‘, ‘1234567‘), (‘小芳‘, ‘18‘, ‘789456‘) ] writer.writerows(data) csvfile.close()
时间: 2024-11-25 19:33:30