Mike Meyer wrote:
That doesn't do what he wants, because it doesn't return until you hit
a newline.

Are you sure that's not just an artifact of how your terminal buffers data for sys.stdin?


$ cat temp.py
import sys
char = sys.stdin.read(1)
while char:
    print char
    char = sys.stdin.read(1)
$ cat temp.txt
abc
def
$ python temp.py < temp.txt
a
b
c


d e f

Of course if the intent is to have this work with terminal input, then yes, sys.stdin.read(1) is probably not going to do the right thing...

Steve
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to