Handling keyboard events in python
问题 How can I handle keyboard events in python? More exactly I need to manage keyboard arrows and some other keys for my command-line application. Is there a module for this or I need to handle key by key using for example "if get(key)==(mykey): do something" (it's pseudo-code)? I'm on Gnu/Linux OS. 回答1: You're probably looking for a python (n)curses library. This will allow to "get around" your terminal buffering and work with key-presses directly. 回答2: Would the cmd module suit your needs? It