Newbie: What's wrong with this 6-line script?
Brent W. Hughes
brent.hughes at comcast.net
Fri Jun 4 01:36:36 CEST 2004
If the file Test1.txt contains 257 words, the following script works as
you'd expect. But if Test1.txt contains 258 words, the last line of the
script prints a blank line instead of the words.
f = file("Test1.txt")
s = f.read()
t = s.split()
BTW, if I run these same lines in the Python interactive shell, it will work
fine even with 20000 words in Test1.txt.
Is there something simple I don't understand?
More information about the Python-list