讀取Excel文件
csv.reader
函數(shù)最為常用
import csv
with open('excel.csv', 'r') as file:
for i in csv.reader(file):
print(i)
寫入Excel文件
csv_write.writerow()
將傳入的列表內(nèi)容寫入到一行中
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/