csv 读
csv写
csv与txt写
out = open("feedbackcsv.csv","w",newline="") csv_writer = csv.writer(out) csv_writer.writerow(["id","ebayno","product_name","price","currency","when_time","shop_name"])
file_object = open("feedback.txt","w") file_object.write(" id, ebayno, product_name, price, currency, when_time,shop_name\n")
file_object.write( str(row[0]) + "," + str(row[1]) + "," + str(row[2]) + "," + str(row[3]) + "," + str(row[4]) + "," + str(row[5]) + "," + str(row[6]) + "\n") csv_writer.writerow([str(row[0]) , str(row[1]) , str(row[2]),str(row[3]) , str(row[4]), str(row[5]) , str(row[6]) ]) file_object.close()
out = open(str(ebayno)+"_fitmentcsv.csv", "w",newline="")
csv_writer = csv.writer(out)
csv_writer.writerow(['fitmentcomment','year','make','model','trim','engine','ebayno'])
csv_writer.writerow([fcomments[i],years[i],makes[i],models[i],trim[i],engine[i],ebayno])