python equivalent of the following program

blue99 at interia.pl blue99 at interia.pl
Thu May 11 10:30:34 EDT 2006


AndyL wrote:
> Hi,
>
> What would by a python equivalent of following shell program:
>
> 	#!/bin/sh
>
> 	prog1 > file1 &
> 	prog2 > file2 &
>
>
> As you see, I need to spawn a few processes and redirect stdout to some
> files.

For example :

------------------cut here-------------------------------
#!/usr/bin/env python

import os

# 1-st variant

os.system("prog1 > tmp1.txt &")

# or 2-nd variant

os.popen("prog1 > tmp2.txt &")
---------------cut here-------------------------------------

Regards,
Rob




More information about the Python-list mailing list