【发布时间】:2015-02-12 03:33:10
【问题描述】:
我需要这样做:
paste file1 file2 file3 > result
我的 python 脚本中有以下内容:
from subprocess import call
// other code here.
// Here is how I call the shell command
call ["paste", "file1", "file2", "file3", ">", "result"])
很遗憾,我收到了这个错误:
paste: >: No such file or directory.
对此的任何帮助都会很棒!
【问题讨论】:
-
重定向不是命令的一部分。
-
在 Python 中很容易模拟
paste命令,例如:for lines in izip(*files): print "\t".join(map(str.strip, lines))
标签: python subprocess