相关疑难解决方法(0)

如何在Python中使用子进程重定向输出?

我在命令行中做了什么:

cat file1 file2 file3 > myfile
Run Code Online (Sandbox Code Playgroud)

我想用python做什么:

import subprocess, shlex
my_cmd = 'cat file1 file2 file3 > myfile'
args = shlex.split(my_cmd)
subprocess.call(args) # spits the output in the window i call my python program
Run Code Online (Sandbox Code Playgroud)

python subprocess

87
推荐指数
3
解决办法
8万
查看次数

标签 统计

python ×1

subprocess ×1