我明白了,我们就可以使用子如何使用Python运行短键?
import subprocess
subprocess.call(["ls", "-l"])
执行的Linux Shell命令,如果我要运行CTRL +ç在终端动作?
我的使用情况是:
1> Open a linux screen
2> Run a command over first window
3> Then create a window in the same screen
4> Run another command over the second window
这是很明显的,我想我的自动化,日常的一些部分。
我不知道这是否可以通过一个shell脚本来完成,你可能会更好过寻找在Python模块,你可以用它来调用键击,然后你就会调用值“^c'其中^ = CTRL,%= ALT,我很久没有做过了,但是其他特殊字符钥匙也 – pythonian29033
你可以看看[os.kill](http://docs.python.org/3/library/os.html)和[signals](http://docs.python.org/3/ library/signal.html)。查找pid是另一回事,但无论如何,您需要一种方法来确定您要关闭的命令。 – 2013-08-07 10:51:03