A completely silly question

Mike Meyer mwm at mired.org
Fri Dec 17 14:52:45 EST 2004


Steven Bethard <steven.bethard at gmail.com> writes:

> Amir Dekel wrote:
>> What I need from the program is to wait for a single character
>> input, something like while(getchar()) in C. All those Python
>> modules don't make much sence to me...
>
> sys.stdin.read(1)

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

The answer is system dependent. Or you can use massive overkill and
get curses, but if you're on windows you'll have to use a third party
curses package, and maybe wrap it


-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list