Paul - The Programmer

simple & stupid
Replace tab with space in VIM
Change the vim default comments syntax color

Execute shell command and get the result by python

paul posted @ Fri, 15 May 2009 20:57:25 +0800 in coding life , 2636 readers
import os

result = os.popen( 'your command' ).read()

print result
 

 

 os.popen() can invoke the inputted command and grab its output as if it is a file-like object.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
  • No match
  • No match

Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter