Unbuffered keyboard input
Andrew Dalke
dalke at acm.org
Tue Nov 7 11:05:51 EST 2000
apighin at my-deja.com wrote:
>I am looking for a way to open the keyboard/console as unbuffered.
Use the '-u' flag to start Python in unbuffered mode.
>What I would like to be able to do is do a stdin.read(1), and if no
>character is available, just go to the top of the loop and try again.
Or read the FAQ entry titled "How to get a single keypress at a time?"
http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.074.htp
(Your mention of /dev/console implies this Unix answer. There's a pointer
to another solution for MS Windows.)
Andrew
dalke at acm.org
More information about the Python-list
mailing list