Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将python eof传递给stdin
这是我的代码
p = Popen(commd,stdout=PIPE,stderr=PIPE,stdin=PIPE) o = p.communicate(inputstring)[0]
当我在输入输入字符串窗口后在命令行中运行 commd 时,仍然期望 Ctrl+Z 完成接受输入。
如何在程序中传递 eof 或 Ctrl+Z?
谢谢!
p.stdin.close()
在 p.communicate 之后,完成输入并将 EOF 发送到 commd。