On Apr 16, 1:08 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
> CSUIDL PROGRAMMEr wrote:
> > hi folks
> > I am new to python. I have a module does call a os.command(cmd) where
> > cmd is a rpm command.
> > Instead of using os.command and getting the results on command line ,
> > i would like to dump the output in a file. Is os.command(cmd >
> > filename)  the most efficient command??
>
> I think the best thing to do would be something like this (Python 2.5):
>
> from __future__ import with_statement
> import subprocess
>
> with file("test.out", "w") as outfile:
>      subprocess.check_call(["ls", "/etc"], stdout=outfile)
> --
> Michael Hoffman


but what if i have python which  is 2.4??


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to