read the output of a system call in python
December 11th, 2007 by Lawrence David
this is almost certainly not the best way to read the output of a python system call. but, it works.   let’s say i’d like to read the results of a call to ls. here’s how to do it:
import subprocess
proc = subprocess .Popen([ls],stdout=sub.PIPE)
print proc.stdout.read()