22 lines
492 B
Python
22 lines
492 B
Python
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
|