What gets returned is the return value of executing this command. What you see in while executing it directly is the output of the command in stdout. That 0 is returned means, there was no error in execution.
Use popen etc for capturing the output .
Some thing along this line:
import subprocess as sub
p = sub.Popen(['your command', 'arg1', 'arg2', ...],stdout=sub.PIPE,stderr=sub.PIPE)
output, errors = p.communicate()
print output
or
import os
p = os.popen('command',"r")
while 1:
line = p.readline()
if not line: break
print line
ON SO : Popen and python
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…