小编spu*_*ATX的帖子

运行包含管道的命令行并将结果显示到STDOUT

如何从包含管道并捕获输出的Python调用shell命令?

假设命令是这样的:

cat file.log | tail -1
Run Code Online (Sandbox Code Playgroud)

Perl相当于我想做的事情就像:

my $string = `cat file.log | tail -1`;
Run Code Online (Sandbox Code Playgroud)

python command-line pipe

38
推荐指数
3
解决办法
4万
查看次数

标签 统计

command-line ×1

pipe ×1

python ×1