How to spawn a program with redirection as it parameter

TH Lim sshark97 at hotmail.com
Thu Jul 3 06:18:33 EDT 2003


Hi,

How do I do a simple thing like  /bin/cat myfile.txt >> yourfile.txt
in unix? I tried with the script shown below but not successful. Am
doing it right? Pls. advise. thank you.

#!/usr/bin/python
import os
os.spawnl(os.P_WAIT, "/bin/cat" , "/bin/cat", "myfile.txt >>
yourfile.txt")
print "Done"




More information about the Python-list mailing list