import subprocess
stat, output = subprocess.getstatusoutput('somecommand')
if stat == 0:
    print('Command succeeded, here is the output: %s' % output)
else:
    pass
How to get output of exe in python script?