python
windows -- console 키보드 입출력
자유프로그램
2014. 7. 21. 13:25
반응형
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)
반응형