Reading from stdin

Bjoern Lindstroem bkhl at swipnet.se
Sun Nov 5 23:41:39 CET 2000


I need to write a program that at some times reads a few lines
from <stdin> and when there is nothing more waiting there, stops
trying to read and is free to do something else. The problem is
that <stdin> is never closed, so I can't check for EOF.

What then? What do you think is the most clever way to solve
this?

I have thought of using signal.alarm(), but that creates to long
delays.

-- 
Bjoern Lindstroem <bkhl at swipnet.se>  http://home.swipnet.se/bkhl/



More information about the Python-list mailing list