Determine what msvcrt.getch() is getting?

Jerry Hill malaclypse2 at gmail.com
Tue Aug 16 20:06:45 EDT 2011


On Tue, Aug 16, 2011 at 5:43 PM, John Doe <jdoe at usenetlove.invalid> wrote:
> Whatever msvcrt.getch() is returning here in Windows, it's not within
> the 1-255 number range. How can I determine what it is returning?
>
> I would like to see whatever it is getting.

Just print it.  Like this:

import msvcrt
ch = msvcrt.getch()
print (ch)

for a bit more information, do this instead:
import msvcrt
ch = msvcrt.getch()
print(type(ch), repr(ch), ord(ch))

-- 
Jerry



More information about the Python-list mailing list