getch() of Turbo C in Python?

Anurag Ved anuragved at vsnl.com
Thu Jun 7 15:08:35 EDT 2001


Hi all,
  I am using the Python interpreter under Windows. When I execute a
Python script, the console window that opens up closes immediately
after the program terminates, leaving me no time to observe the
output. One solution is to append the program with

raw_input('')

But, this is certainly not elegent and moreover it requires the user
to press 'enter' rather than the preferred option of 'any key'.

Is there something similar to the getch() function of Turbo C which
reads just one key from <stdin> and returns immediately?

Thanx in advance!

- Anurag



More information about the Python-list mailing list