Your python script does not have the output of the bash script at all, but only the "0" returned by it. The output of the bash script went to the same output stream as the python script, and printed before you printed the value of result. If you don't want to see the 0, do not print result.