<font color='black' size='2' face='arial'>
<div style="CLEAR: both">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. </div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both"># This shows that I'm reading the file in correctly:</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">input_file=open("test-8-29-10.csv","rb")<br>
for row in input_file:<br>
&nbsp; &nbsp;print row</div>


<div style="CLEAR: both"><br>
MyWord,Category,Ct,CatCt</div>


<div style="CLEAR: both">!,A,2932,456454</div>


<div style="CLEAR: both">!,B,2109,64451</div>


<div style="CLEAR: both">a,C,7856,90000</div>


<div style="CLEAR: both">abandoned,A,11,456454<br>
....</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both"># But when I try to add columns, I'm only filling in some static value. So there's something wrong with my looping.</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">testReader=csv.reader(open('test-8-29-10.csv', 'rb'))<br>
for line in testReader:<br>
&nbsp;for MyWord, Category, Ct, CatCt in testReader:<br>
&nbsp;&nbsp;&nbsp;text=nltk.word_tokenize(MyWord)<br>
&nbsp; &nbsp;word2=wnl.lemmatize(word)<br>
&nbsp;&nbsp; word3=porter.stem(word)<br>
&nbsp;&nbsp; print MyWord+","+Category+","+Ct+","+CatCt+","+word+","+word2+","+word3+"\r\n"</div>


<div style="CLEAR: both">&nbsp;&nbsp;<br>
!,A,2932,456454,yrs,yr,yr</div>


<div style="CLEAR: both">!,B,2109,64451,yrs,yr,yr</div>


<div style="CLEAR: both">a,C,7856,90000,yrs,yr,yr</div>


<div style="CLEAR: both">abandoned,A,11,456454,yrs,yr,yr<br>
...</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both"># I tried adding another loop, but it gives me an error.</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">testReader=csv.reader(open('test-8-29-10.csv', 'rb'))<br>
for line in testReader:<br>
&nbsp; &nbsp;for MyWord, Category, Ct, CatCt in line:&nbsp; # I thought this line inside the other was clever, but, uh, not so much<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text=nltk.word_tokenize(MyWord)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word2=wnl.lemmatize(word)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;word3=porter.stem(word)<br>
&nbsp;&nbsp;print MyWord+","+Category+","+Ct+","+CatCt+","+word+","+word2+","+word3+"\r\n"</div>


<div style="CLEAR: both">&nbsp;&nbsp;</div>


<div style="CLEAR: both">Traceback (most recent call last):<br>
&nbsp; File "&lt;pyshell#256&gt;", line 2, in &lt;module&gt;<br>
&nbsp;&nbsp;&nbsp; for MyWord, Category, Ct, CatCt in line:<br>
ValueError: too many values to unpack</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">My hope is that once I can figure out this problem, it'll be easy to write the csv file with the csv module. But I'm stumped about the looping.</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">Thanks for any suggestions,</div>


<div style="CLEAR: both">&nbsp;</div>


<div style="CLEAR: both">Tyler</div>
</font>