import msvcrt, time LoopContinue = True while LoopContinue: x = msvcrt.kbhit() print x if x != 0: LoopContinue = False time.sleep(1.0)