一、读写csv数据
import csv ‘‘‘读csv数据‘‘‘ rf = open(‘csvName.csv‘, ‘rb‘) reader = csv.reader(rf) ‘‘‘写csv数据‘‘‘ d = [‘Id‘, ‘Name‘, ‘Sex‘, ‘age‘, ‘score‘] wf = open(‘csvName1.csv‘, ‘wb‘) writer = csv.writer(wf) writer.writerow(d) for r in reader: writer.writerow(r) wf.flush()
时间: 2024-10-10 10:58:04