Line-by-line processing when stdin is not a tty

RG rNOSPAMon at flownet.com
Wed Aug 11 09:11:43 CEST 2010


When stdin is not a tty, Python seems to buffer all the input through 
EOF before processing any of it:

[ron at mickey:~]$ cat | python
print 123
print 456 <hit ctrl-D here>
123
456

Is there a way to get Python to process input line-by-line the way it 
does when stdin is a TTY even when stdin is not a TTY?

Thanks,
rg



More information about the Python-list mailing list