On Mon, Aug 30, 2010 at 12:04 PM, <aenea...@priest.com> wrote: > I checked out the csv module and got a little further along, but still can't > quite figure out how to iterate line by line properly. > > # But when I try to add columns, I'm only filling in some static value. So > there's something wrong with my looping. > > testReader=csv.reader(open('test-8-29-10.csv', 'rb')) > for line in testReader: > for MyWord, Category, Ct, CatCt in testReader: > text=nltk.word_tokenize(MyWord) > word2=wnl.lemmatize(word) > word3=porter.stem(word)
here's your problem. MyWord is the value that is changing in each iteration of the loop, not word. Change your lines to word2=wnl.lemmatize(MyWord) word3=proter.stem(MyWord) and it should work fine. You should've gotten an undefined variable exception, unless you defined word somewhere else. Watch those variable names! HTH, -Luke _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor