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

Fernando Perez fperez528 at yahoo.com
Tue Jul 13 18:09:07 EDT 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 os.name 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/commands.py
Definition:     commands.getoutput(cmd)
Docstring:
    Return output (stdout or stderr) of executing cmd in a shell.

Cheers,

f



More information about the Python-list mailing list