[Tutor] readlines() ... problem

James Roberts James@BlahBlahJsRoberts.com
Fri, 25 Jan 2002 10:50:25 -0800


I have a file, a text file, that has 15 or so lines of text, each line
ending in hard-return (Windows).  None of the lines are quoted, nor
are they delimited by comma's, or anything else.

When I execute, in Komodo, a script that goes:

list =3D open("list")
s =3D list.read()
print s

... I get the entire contents of the file printed out, just as it was
in the source file.  This I expect.  But, if I do the following:

list =3D open("list")
s =3D list.readlines()
print list

... then, all I get is several of the lines from the source file.  The
lines do output as a list, with the lines of the source presented as
strings, with newlines at the end of each of the source lines, but the
ouput is only a few of the lines from the source.=20

However:  Iif do the same  two operations above -- but do it in  Idle,
entering each command individually on the command line -- I get the
results I expect.  That is, the readlines() will output the entire
source file as expected.=20

Why won't the script in Komodo do the same?
Any help would be appreciated.

-- Jim