python处理csv数据
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"),quoting=csv.QUOTE_ALL)#传入listwriter.writerow(["121","121"])#传入2纬listwriter.writerows([["121","121"]])
out = csv.writer(open("myfile.csv","w"), delimiter=',',quoting=csv.QUOTE_ALL) 91 out.writerows(results)