How to get the os.system data into a variable

Trent Mick trentm at ActiveState.com
Tue Dec 19 20:29:33 EST 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.

Cheers,
Trent


-- 
Trent Mick
TrentM at ActiveState.com




More information about the Python-list mailing list