Python as a scripting language. Alternative to bash script?
sturlamolden
sturlamolden at yahoo.no
Tue Jul 6 06:12:08 EDT 2010
On 28 Jun, 19:39, Michael Torrie <torr... at gmail.com> wrote:
> In python I could simply take the output of "ps ax" and use python's
> own, superior, cutting routines (using my module):
>
> (err, stdout, stderr) = runcmd.run( [ 'ps', 'ax' ] )
> for x in stdout.split('\n'):
> print x.strip().split()[0]
Or you just pass the stdout of one command as stdin to another. That
is equivalent of piping with bash.
More information about the Python-list
mailing list