csv模块
2020-03-31 本文已影响0人
Iphone60Plus
import csv
# csv.reader(f) 读取csv文件
with open('/Users/zhanglihui/Downloads/test.csv','r',newline='',encoding='utf-8') as f:
reader = csv.reader(f)
for row in reader:
print(row)
# csv.writer(f) 写入csv文件
with open('/Users/zhanglihui/Downloads/test.csv','w') as f:
writer = csv.writer(f)
writer.writerow(['j','r','s','2'])
# 待更新