csv数据读取方法

 1 import csv
 2 
 3 def get_csv_data(csv_file, line):
 4     with open(csv_file, 'r') as file:
 5         reader = csv.reader(file)
 6         for index, row in enumerate(reader):
 7             if index == line:
 8                 return row
 9  
10 csv_file = '../data/account.csv'
11 data = get_csv_data(csv_file, 3)
12 print(data)

posted on 2019-07-13 11:25  cherry_ning  阅读(200)  评论(0)    收藏  举报

导航