[Tutor] readlines code

Cliff Martin camartin@snet.net
Mon Jun 30 21:43:01 2003


Hi,

I'm trying to read in an ASCII file of a fairly large set of data with 
data separated by spaces and each line ending with a linefeed.  If I use 
readlines() I get all the data but each line still has a \n tacked on. 
 If I use:

f=open("c:/transfer/filename")
for line in f.readlines():
        words=line.rstrip().split()

I get only the last line of the file in words.  Could someone explain 
why this is happening?  There is something about the use of Python here 
that I'm not understanding.  Thanks for any help.

Cliff Martin