Can someone explain why the result I want, \"hi\", is preceded with a letter \'b\' and followed with a newline?
I am using Python 3.3
b is the byte representation and \n is the result of echo output.
Following will print only the result data
import subprocess print(subprocess.Popen("echo hi", shell=True,stdout=subprocess.PIPE).communicate()[0].decode('utf-8').strip())