Beginner asks question about Python on Linux
Garrett G. Hodgson
garry at research.att.com
Mon Oct 11 14:22:00 EDT 1999
stephen.allison at cenes.co.uk wrote:
> I'm writing some scripts to do some general administation tasks, and
> need to get the output of a shell command into Python easily.
try this:
from commands import getstatusoutput
stat, output = getstatusoutput( 'ps aux|grep someProcess' )
output will have stdout and stderr from the command,
and stat will have process status
--
Garry Hodgson "Hey, mister, can ya tell me,
garry at sage.att.com where a man might find a bed?"
Software Innovation Services He just grinned and shook my hand,
AT&T Labs "No", was all he said.
More information about the Python-list
mailing list