Python CSV写入操作
作者:互联网
#!/user/bin/env python3
# -*- coding: utf-8 -*-
import csv
with open("./test.csv",'w',encoding='gbk',newline='') as f:
csv_writer=csv.writer(f)
csv_writer.writerow(['shiyu41','18','男'])
csv_writer.writerow(['x','18','女'])
csv_writer.writerow(['l','18','男'])
csv_writer.writerows([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) # 写入多行writerows
f.close()
标签:csv,writerow,Python,18,writer,写入,writerows,CSV 来源: https://blog.csdn.net/qq_27694835/article/details/111697656