【转】python处理csv数据
http://desert3.iteye.com/blog/772246
1 import csv 2 3 #从文件读取 4 reader = csv.reader(file(srcFilePath,'rb')) 5 6 for line in reader: 7 #忽略第一行 8 if reader.line_num == 1: 9 continue 10 11 #line是个list,取得所有需要的值 12 type = line[0] 13 14 15 #写入文件 16 writer = csv.writer(open(targetFile,"wb"),quoting=csv.QUOTE_ALL) 17 18 #传入list 19 writer.writerow(["121","121"]) 20 21 #传入2纬list 22 writer.writerows([["121","121"]])