Alternative to raw_input ?

BOOGIEMAN BOOGIEMANPN at YAHOO.COM
Sat Feb 12 16:16:53 EST 2005


On Fri, 11 Feb 2005 21:38:47 -0500, Peter Hansen wrote:

> print prompt
> while msvcrt.kbhit():
>      msvcrt.getch()
> msvcrt.getch()

Thanks, it works but without line "print prompt" and also
I'm not sure if I should put this function :

def cekaj():
    while msvcrt.kbhit():
        msvcrt.getch()
    msvcrt.getch()

#Or this one, which sounds more logical according to help
#kbhit() - Return true if a keypress is waiting to be read. 

def cekaj():
    msvcrt.getch()
    while msvcrt.kbhit():
        msvcrt.getch()
     
It works both ways, not sure which one is right



More information about the Python-list mailing list