How to spawn a program with redirection as it parameter

POYEN OP Olivier (DCL) Olivier.POYEN at clf-dexia.com
Thu Jul 3 08:22:01 EDT 2003


import os
os.system('your sh line of command')

python will be waiting.
It returns the command line return result.


HTH

--OPQ

> -----Message d'origine-----
> De : TH Lim [mailto:sshark97 at hotmail.com]
> Envoyé : jeudi 3 juillet 2003 12:19
> À : python-list at python.org
> Objet : How to spawn a program with redirection as it parameter
> 
> 
> 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"
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-------------- next part --------------
-----------------------------------------------------------------

Ce message est confidentiel ; son contenu ne represente en aucun

cas un engagement de la part de Dexia Credit Local ou de Dexia

CLF Banque. Toute publication, utilisation ou diffusion, meme

partielle, doit etre autorisee prealablement par l'emetteur. Si

vous n'etes pas destinataire de ce message, merci d'en avertir

immediatement l'expediteur.



This message is confidential ; its contents do not constitute a

commitment by Dexia Credit Local or Dexia CLF Banque. Any

unauthorised disclosure, use or dissemination, either whole or

partial, is prohibited. If you are not the intended recipient of

the message, please notify the sender immediately.

-----------------------------------------------------------------

Consultez notre site internet www.dexia-clf.fr

La cle d'une gestion optimisee du secteur public local

-----------------------------------------------------------------


More information about the Python-list mailing list