can i make sys.stdin.read() not wait?

thelocust at my-deja.com thelocust at my-deja.com
Thu Dec 7 01:57:34 EST 2000


I'm working on a program that requires me to read in input (usually one
character) if it is input.  For example, i have a while loop that looks
like this:

while 1:
      x = sys.stdin.read(1)
      if x == 'q':
           break
      test.handlestuff()

Well, my problem is is that it seems that read MUST have input to move
on.  Is there any way that it just attempts to get whatever is on the
TTY?  or maybe the last thing that was put to it?


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list