import subprocess
proc = subprocess.Popen('echo "to stdout"', shell=True, stdout=subprocess.PIPE)
output = proc.communicate()[0]
print(output)
Any way to assign terminal output to variable with python?