python模块-csv模块
程序员文章站
2022-07-10 20:22:56
...
读取数据
import csv
# print(dir(csv))
with open('Z16.csv','r',newline='',encoding='UTF-8-sig') as f1:
reader = csv.reader(f1)
for row in reader:
print(row)
追加数据
import csv
with open('test.csv','a',newline='',encoding='utf-8') as f:
writer = csv.writer(f)
writer.writerow(['4', '猫砂', '25', '1022', '886'])
writer.writerow(['5', '猫罐头', '18', '2234', '3121'])
下一篇: suricata规则阈值设置