[Tutor] need help with msvcrt.getch()

Tim Golden mail at timgolden.me.uk
Tue Jul 27 16:36:31 CEST 2010


On 27/07/2010 15:22, Richard D. Moores wrote:
> Python 3.1 on Vista.
>
> Please see<http://tutoree7.pastebin.com/f3TaxDBc>.
>
> I'm trying to recall what I used to know, thus this simple script. But 'y'
> or 'q' do nothing. What's wrong?

msvcrt.getch returns bytes on Python 3.1; you're comparing against
string. Try

if key == b'y':
   ... etc.

TJG


More information about the Tutor mailing list