Newbie: What's wrong with this 6-line script?

  • Thread starter Brent W. Hughes
  • Start date
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
 
L

Larry Bates

A known problem in the interpreter. If
output lines get too long the "disappear".
If you scroll right with mouse by clicking
the right arrow, you will see the line
"magically" appear.

Larry Bates
Syscon, Inc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top