windows  --  console 키보드 입출력



참조 : https://docs.python.org/2/library/msvcrt.html

import msvcrt
import time

while 1:
    if msvcrt.kbhit():
        c = msvcrt.getwch()
        if c == u'\x1b':  # ESC key  -> exit
            print '\n -- exit ---\n'
            time.sleep(1) 
            break
        if c == u'\00' or c == u'\xe0':  # function key
            msvcrt.getwch() # skip function keycode 
        else :
            msvcrt.putwch(c)








Posted by 자유프로그램