B
Brent W. Hughes
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.
==========================
import sys
f = file("Test1.txt")
s = f.read()
f.close()
t = s.split()
print t
===========================
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?
Brent
you'd expect. But if Test1.txt contains 258 words, the last line of the
script prints a blank line instead of the words.
==========================
import sys
f = file("Test1.txt")
s = f.read()
f.close()
t = s.split()
print t
===========================
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?
Brent