csv文件读取
pd.read_csv('data.csv')
csv文件写入
转自:https://blog.csdn.net/weixin_43670105/article/details/89045301
import csv csvfile = open("csv_test.csv","w",newline = "") #将文件加载到csv对象中 writer = csv.writer(csvfile) #写入一行数据 writer.writerow(['姓名','年龄','电话']) #多行数据写入 data = [('张三','18','0291321332'), ('李四','21','2932131934')] writer.writerows(data) #关闭csv对象 csvfile.close()
写入效果