getch in python

Eric Brunel eric.brunel at pragmadev.com
Tue Sep 3 03:57:16 EDT 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