1 #coding = 'utf-8' 2 3 import csv 4 5 # 使用list,只能读取列,而且是全文读取,csv.reader会自动把CSV内容生成数组 6 ''' 7 df = csv.reader(open('F:c_databasec2015.csv')) 8 for data in df: 9 print (data[3]) 10 ''' 11 12 #如果要读取某行,必须将CSV内容生成 DICT字典(2维) 13 with open('F:c_databasec2015.csv','r') as csvfile: 14 reader = csv.DictReader(csvfile) 15 for row in reader: 16 if row['日期'] == '20150105': 17 print (row)