Executing a shell command

Michael Hudson mwh at python.net
Sat Jun 2 06:45:00 EDT 2001


"Kevin Riggle" <vj$ri^gg#guess#l55e at mt$*guess#&cn1e#t.!@n()et> writes:

> Is there any way to take a command in a string in Python, execute it in the
> shell, and read the output into a variable of some sort, like
> 
> result = execute(cmdline)

>>> import commands
>>> print commands.getoutput.__doc__ 
Return output (stdout or stderr) of executing cmd in a shell.

Cheers,
M.

-- 
  > Look I don't know.  Thankyou everyone for arguing me round in
  > circles.
  No need for thanks, ma'am; that's what we're here for.
                                    -- LNR & Michael M Mason, cam.misc



More information about the Python-list mailing list