What I do in the command line:
cat file1 file2 file3 > myfile
What I want to do with python:
import subprocess, shlex
my
UPDATE: os.system is discouraged, albeit still available in Python 3.
Use os.system
:
os.system(my_cmd)
If you really want to use subprocess, here's the solution (mostly lifted from the documentation for subprocess):
p = subprocess.Popen(my_cmd, shell=True)
os.waitpid(p.pid, 0)
OTOH, you can avoid system calls entirely:
import shutil
with open('myfile', 'w') as outfile:
for infile in ('file1', 'file2', 'file3'):
shutil.copyfileobj(open(infile), outfile)