What is the difference if I don't use stdout=subprocess.PIPE in subprocess.Popen()?

前端 未结 2 1187
庸人自扰
庸人自扰 2020-12-15 11:01

I recently noted in Python the subprocess.Popen() has an argument:

stdout=None(default)

I also saw people using stdout=subproc

2条回答
  •  星月不相逢
    2020-12-15 11:18

    • stdout=None means that subprocess prints to whatever place your script prints
    • stdout=PIPE means that subprocess' stdout is redirected to a pipe that you should read e.g., using process.communicate() to read all at once or using process.stdout object to read via a file/iterator interfaces

提交回复
热议问题