reading one byte from stdin

Mark McDuff mmcduff at
Wed Jul 16 07:39:38 CEST 2008

I'm trying to read one byte from stdin, without the newline.

If I try something like:
 >>> import os, sys

I can input a character, but then I have to press enter, which leaves  
a newline character in the stdin buffer and requires two keypresses.   
Is there any way to read only one keypress in a simple manner (i.e. no  

More information about the Python-list mailing list