Python:重定向到带有子进程的多文件描述符
如何使用子进程重定向到多个文件描述符?假设在命令行中我使用了Python:重定向到带有子进程的多文件描述符,python,redirect,subprocess,Python,Redirect,Subprocess,如何使用子进程重定向到多个文件描述符?假设在命令行中我使用了python3test.py4>fd4.txt 5>fd5.txt,但我想在子流程中运行它,我该如何做 我知道如果只是重定向到stdout,我可以做如下操作: with open('myfile', "w") as outfile: subprocess.run(my_cmd, stdout=outfile) 但我不知道如何重定向到特定的文件描述符
python3test.py4>fd4.txt 5>fd5.txt
,但我想在子流程中运行它,我该如何做
我知道如果只是重定向到stdout,我可以做如下操作:
with open('myfile', "w") as outfile:
subprocess.run(my_cmd, stdout=outfile)
但我不知道如何重定向到特定的文件描述符