New to Python; what about #include, extern and function prototypes

David M. Cook davecook at nowhere.net
Sun Mar 7 09:37:25 EST 2004


In article <RGF2c.105804$jf4.6360171 at news000.worldonline.dk>, Bo Jacobsen
wrote:

> By the way, is there an elegant way to read shell program output
> into a variable as in bash: var=$(command1 | command2)

I usually use the commands module:

  import commands

  status, output = commands.getstatusoutput("command1 | command2")
  
status would be $? in bashese.
  
Dave Cook






More information about the Python-list mailing list