I\'m using this code to get standard output from an external program:
>>> from subprocess import * >>> command_stdout = Popen([\'ls\', \'-l
From sys — System-specific parameters and functions:
To write or read binary data from/to the standard streams, use the underlying binary buffer. For example, to write bytes to stdout, use sys.stdout.buffer.write(b'abc').
sys.stdout.buffer.write(b'abc')