newbie:trying to read in stdoutput of commands under various *nixes

Fernando Perez fperez528 at
Wed Jul 14 00:09:07 CEST 2004

googleboy wrote:

> Hiya.
> I am fumbling around here, and it is getting quite late.
> I am doing something really simple - trying to write something that
> will get the results of a uname command to decide whether the system
> is Linux or OpenBSD in preparation for running a couple of commands
> that have different syntax on the different systems.  I first started
> out doing but quickly realised this wasn't what I was after.
> So I am trying stuff like:

In [1]: import commands

In [2]: commands.getoutput?
Type:           function
Base Class:     <type 'function'>
String Form:    <function getoutput at 0x9ec5fd4>
Namespace:      Interactive
File:           /usr/lib/python2.2/
Definition:     commands.getoutput(cmd)
    Return output (stdout or stderr) of executing cmd in a shell.



More information about the Python-list mailing list