## python 2.7.3
import csv
writer=csv.writer(open("output.csv","wb"), delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL)
with open('products.csv', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter='@')
##    for row in spamreader:
##        writer.writerow(row[0].strip() + row[1].strip() + row[2].strip() +row[3].strip() +row[4].strip() +row[5].strip() + row[6].strip() + row[7].strip() + row[8].strip() + row[9].strip())
    x = 0
    for row in spamreader:
        x = x  + 1
        if (x % 100) == 0:
            writer=csv.writer(open("output"+str(x)+".csv","wb"), delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL)
        if row[9] != "":
            temp = row[9]
            row[9] = 'content_to_append' + temp
        writer.writerow(row)

Leave a Reply

Close Menu
%d bloggers like this: