Redirecting system output quietly

Hugo Gonz?lez hugonz at hotmail.com
Tue Nov 16 11:16:08 EST 2004


There's an even easier way to do this. You can use the "commands"
module:

http://www.python.org/doc/current/lib/module-commands.html

This is easier and faster than using popen, and will allow you to get
exit status (os.popen* won't let you)

Hugo


> > Hi,
> >  I am a newbie here. I want to know how to redirect os.system("ls -af")
> > to a string variable without it barfing the answer of ls -af on the
> > screen.
> >
> > Thanks in advance,
> > Madhusudhanan.C



More information about the Python-list mailing list