pierre cutellic wrote: > Hi, > I wrote this script to select some data from a csv file. > Actually it writes it into a file but i would like to append it into an > existing one to a specific line without removing existing code. > does the open(' filename.csv','a+') can do that? > > ag = elem[0] > ag.split(";")
Here I think you want ag = ag.split(';') split() does not split the string in place, it returns a new list with the split elements. Also you are opening the file for writing (which will erase the contents) before you read it. Other than that your code looks OK. You might want to try writing it without functions, I think they may be confusing you a bit and they are not really needed here. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor