aicheckv2-api/utils/csv_utils.py

22 lines
492 B
Python
Raw Normal View History

2025-04-11 08:54:28 +08:00
import csv
def read_csv(file_path):
"""
根据文件路径读取csv文件
:param file_path:
:return:
"""
with open(file_path, 'r', encoding='utf-8') as file:
# 创建 CSV 阅读器对象
csv_reader = csv.reader(file)
# 跳过标题行
next(csv_reader)
result_row = []
for row in csv_reader:
if row is None:
break
result_row.append(row)
return result_row
return None