请求键盘中断的应用程序。如何以编程方式发送键盘中断?我需要它来实现自动化。
喜欢<C-c>
或 <C-x>
KeyboardInterrupt
最佳答案
在单独线程中运行的代码可以通过调用 thread.interrupt_main()
在主线程中生成 KeyboardInterrupt
。
参见 https://docs.python.org/2/library/thread.html#thread.interrupt_main
关于python - 以编程方式发送键盘中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7602120/