我正在为自动化编写python脚本
我需要运行一个linux shell命令(程序:dvbv5-zap
),并等待特定的命令输出(DVR interface '/dev/dvb/adapter0/dvr0' can now be opened
)。当命令输出这个字符串时,python应该运行另一个shell程序
我不知道如何捕获子流程cli输出,我尝试了.stdout.readline()
,但什么都没有得到。
我用subprocess.Popen(['dvbv5-zap', 'args'], stdout=subprocess.PIPE)
运行一个命令
我在这里找到了答案:https://fredrikaverpil.github.io/2013/10/11/catching-string-from-stdout-with-python/
代码段:
相关问题 更多 >
编程相关推荐