I have this sample.csv file:
a 1 apple
b 2 banana
c 3 cranberry
d 4 durian
e 5 eggplant
And have the following code:
samplefile = open(sample.csv,'rb')
rows = samplefile .readlines()
outputfile = open(output.csv,'wb')
wr = csv.writer(outputfile)
for row in rows:
wr.writerow(row)
What I wanted to to is write on the first row of outputfile at some point during the for loop, i.e. when outputfile may already have entries.