Python subprocess get children's output to file and terminal?
问题 I\'m running a script that executes a number of executables by using subprocess.call(cmdArgs,stdout=outf, stderr=errf) when outf / errf is either None or a file descriptor (different files for stdout / stderr ). Is there any way I can execute each exe so that the stdout and stderr will be written to the files and terminal together? 回答1: The call() function is just Popen(*args, **kwargs).wait(). You could call Popen directly and use stdout=PIPE argument to read from p.stdout : import sys from