How to get the os.system data into a variable

Jose Isaias Cabrera jicman at cinops.xerox.com
Thu Dec 21 17:09:46 CET 2000


> On Tue, Dec 19, 2000 at 05:23:29PM +0000, jicman wrote:
> > I know that
> > 
> > t = os.system('ls -l')
> 
> o = os.popen('ls -l')
> output = o.read()
> o.close()
> 
> "output" now contains the output. Also look at os.popen2, os.popen3, etc for
> when you want handles on stderr and stdin inaddtion to the usual stdout.

thanks.





More information about the Python-list mailing list