getch in python

Eric Brunel eric.brunel at pragmadev.com
Tue Sep 3 09:57:16 CEST 2002


Venkat Venkataraju wrote:

> Hi All
> 
> Is there any function that behaves like getch() function in C?
> 
> Venkat

Seems like this is what you want:

import sys
c = sys.stdin.read(1)

On EOF, c is just ''.

HTH
-- 
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com



More information about the Python-list mailing list