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.
Pythoneofを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に送信します。