Python stdin eof

How to pass python eof to stdin

here is my code

p = Popen(commd,stdout=PIPE,stderr=PIPE,stdin=PIPE)
o = p.communicate(inputstring)[0]

when I run commd on the command line after entering the input lines that are still waiting for Ctrl + Z to finish receiving input.

How can I pass eof or Ctrl + Z in a program?

Thanks!

+3
source share
1 answer
p.stdin.close()

after p.communicate, completes the input and sends the EOF to commd.

+9
source

Source: https://habr.com/ru/post/1722747/


All Articles