How to input one char at a time from stdin?
steven.bethard at gmail.com
Tue Jan 25 14:54:00 EST 2005
Swaroop C H wrote:
> On Tue, 25 Jan 2005 12:38:13 -0700, Brent W. Hughes
> <brent.hughes at comcast.net> wrote:
>>I'd like to get a character from stdin, perform some action, get another
>>character, etc. If I just use stdin.read(1), it waits until I finish typing
>>a whole line before I can get the first character. How do I deal with this?
> This is exactly what you need:
> Title: "getch()-like unbuffered character reading from stdin on both
> Windows and Unix"
> This recipe was a lifesaver for me once :-)
Thanks for the link! I've seen this question before a few times, but no
one had pointed out the recipe.
More information about the Python-list