Python(3.5.1)在运行时与程序通信

时间:2016-05-19 10:49:18

标签: python python-3.x subprocess popen

我真的很陌生。我希望在程序运行时将命令发送到程序(Dota 2)。

到目前为止,这就是我所拥有的:

import subprocess

dota_exe = r'C:\Program Files (x86)\Steam\SteamApps\common\dota 2 beta\game\bin\win64\dota2.exe'
dota = subprocess.Popen([dota_exe], shell=True, \
                            stdin=subprocess.PIPE, \
                            stdout=subprocess.PIPE, \
                            stderr=subprocess.STDOUT, )

程序运行后(dota.poll()保持等于None)我希望能够与程序通信,即知道它在做什么。我还想发送一些命令(不知道它是否可能,我不知道我可以发送哪些命令,maybe these ones)。任何建议或参考将不胜感激。

0 个答案:

没有答案
相关问题