The Scoop on Python Input?

Rainy sill at
Tue Jun 19 11:50:09 CEST 2001

On Tue, 19 Jun 2001 02:59:57 -0000, GulickDO at <GulickDO at> wrote:
> Hey gang.  I recently fell in love with Python for Linux and have 
> been doing a fair amount of work programming console-based apps.  I 
> have about three or four Python reference books and was pretty 
> disappointed how poorly the concept of "input" was covered in the 
> books!  So maybe someone here can send me in the right direction.
> Is there a Python input function that will get just one character 
> from the keyboard without waiting for enter to be pressed? (like getch
> () in C++?)  I found a module that provides getch(), but it is 
> restricted to Window's-based platforms.
> Any suggestions would be appreciated.
> Thanks.
> G.

Yep, there is a way but it isn't too pretty. It's covered in python faq. It
only seems to work for 2.1, though :/. Also, there doesn't seem to be any
way to unget the character, i.e. make a progress indicator that shows
37% 42% etc but in one place as something progresses, except in curses.


Lucifer Sam Siam cat
Always sitting by your side
Always by your side
That cat's something I can't explain
        - Syd

More information about the Python-list mailing list