【发布时间】:2023-09-05 04:51:01
【问题描述】:
我知道可以通过writeing 将可打印输入发送到subprocesses 到他们的stdin
from subprocess import, Popen, PIPE
proc = Popen([command, goes, here], stdin=PIPE)
proc.stdin.write("m")
我将如何发送诸如箭头键按下、空格、回车或退格之类的输入?
【问题讨论】:
-
您是否尝试运行特定命令?
-
@NathanVillaescusa - 具体来说,我正在尝试将
omxplayer作为子进程运行并发送左/右/上/下箭头以进行搜索。它的其余交互命令使用可打印字符。