【发布时间】:2013-06-25 15:21:03
【问题描述】:
我一直在搜索,虽然我发现关于如何让 python 让 linux 使用 cat 函数将文件连接到单个文件的方法很长而且很复杂(许多功能我不需要)。
从我的阅读显然 subprocess 是做到这一点的方法。 这是我所拥有的,但显然不起作用:(
subprocess.call("cat", str(myfilelist[0]), str(myfilelist[1]), str(myfilelist[2]), str(myfilelist[3]), ">", "concatinatedfile.txt"])
以上假设:
myfilelist[]
上面的列表有 4 个文件名 + 路径作为一个列表;例如列表中的一项是“mypath/myfile1.txt”
我也会采用非子流程(但简单)的方法
【问题讨论】:
标签: python linux concatenation