How to control interactive console input/output from Python on Windows?
问题 I need to control a Windows program, which reads input directly from console by calling _kbhit and _getch from <conio.h> . An example of such program can be found here: https://stackoverflow.com/a/15603102/365492 On Linux I can use pty.openpty() to create new pseudo-terminal and to emulate key presses. See this example: https://code.google.com/p/lilykde/source/browse/trunk/lilykde/py/runpty.py On Windows I tried to write to CONIN$ / CONOUT$ but all I can see is that my data is appearing on