CSV Issue

Rohan vodela.sai at gmail.com
Thu Jul 26 17:19:16 EDT 2007


I'm having a  trouble consider this

import csv
f = open("/home/t/tp/va/some7.csv", "rb")
reader =csv.reader(f)
rows =[]
for row in reader:
   rows.append(row)



rows[1].append('1')

print rows
f = open("/home/t/tp/va/e7.csv", "ab")
writer =csv.writer(f)

writer.writerows(rows)
f.close()

In the file some7.csv there is already some data like this
1
2
3
4
Now i'm trying to add a '1' in row2 so that data can be like this
1
2,1
3
4
Instead i'm getting like this
1
2
3
4
1
2,1
3
4

can some one explain this and how to get it in the way i want it/




More information about the Python-list mailing list