I need to integrate shell program with python. I'm wondering if there
is a way get the output of the shell program called by os.system().
Thank you!
popen should do what your after. There are several modules that have
a popen method including os and subprocess. It will allow you to make
a system call similar to os.system, but it gives you pipe access, like
an open file, to the standard output and standard error if you use
subprocess.Popen. A simple example would be:
import subprocess
output = subprocess.Popen('pwd')
print('Present Working Directory is: ' + output.readline())
Hope that helps.
-John