读取一个cvs文件,一行一行输出出来

import csv
 
file = 'D:\\1.csv'
 
with open(file, encoding="UTF8") as f:    
	reader = csv.reader(f)        # 创建 读取器
	header_row = next(reader)     # 获取表的第一行(一般是列名)
	print(header_row)             # 打印
 
	first_row = next(reader)      # 获取标的第二行
	print(first_row)

  

posted @ 2023-10-29 17:12  樱圃  阅读(27)  评论(0编辑  收藏  举报