读取Excel文件
csv.reader
函数最为常用
import csv
with open('excel.csv', 'r') as file:
for i in csv.reader(file):
print(i)
写入Excel文件
csv_write.writerow()
将传入的列表内容写入到一行中
import csv
with open('excel.csv', 'w', newline='') as file:
csv_write = csv.writer(file)
csv_write.writerow(['1', '2', '3'])
csv_write.writerow(['4', '5', '6'])
本文摘自 :https://www.cnblogs.com/