Hot python input loop -


I have to do something like the following pseudo code:

  There is no input and timer & Lt; 5: input = getChar () timer = time.time () - start with the timer; = 5: Print "took too long" Second: print input  

Anyway to do it without threading? I would like an input method that was called the last time, or none ( null ) if nothing was recorded, whatever has been entered.

with the * nix you want sys.stdin . On Windows you want msvcrt.kbhit () and msvcrt.getch () .


Comments