http://desert3.iteye.com/blog/772246 import csv #从文件读取 reader = csv.reader(file(srcFilePath,'rb')) for line in reader: #忽略第一行 if reader.line_num == 1: continue #line是个list,取得所有需要的值 type = line[0] #写入文件 writer = csv.writer(open(targetFile,"wb"),q…
1.什么是csv文件 The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in RFC 4180. 2.…
csv数据:逗号分隔值,其文件以纯文本的形式存储表格数据(数据和文本).csv模块是python的内置模块,需要引用后再使用 csv.reader(csv_file) #使用with结构 with open("data/data.csv","r”,encoding="utf8") as fp: data=csv.reader(fp) #使用for迭代reader对象 for line in reader csv.writer(csv_file) #写入cs…