#coding = 'utf-8' import csv # 使用list,只能读取列,而且是全文读取,csv.reader会自动把CSV内容生成数组 ''' df = csv.reader(open('F:\c_database\c2015.csv')) for data in df: print (data[3]) ''' #如果要读取某行,必须将CSV内容生成 DICT字典(2维) with open('F:\c_database\c2015.csv','r') as csvfile: r…
文件小的读取方法 with open("a1.txt","r",encoding="gbk") as f: r = f.readlines() print(r[0]) # 读第一行 print(r[-1]) # 读最后一行 文件大的读取方法 with open("a1.txt","rb") as f: print(f.readline().decode("gbk")) # 读第一行 of…