I\'m using this code to get standard output from an external program:
>>> from subprocess import * >>> command_stdout = Popen([\'ls\', \'-l
While @Aaron Maenpaa's answer just works, a user recently asked:
Is there any more simply way? 'fhand.read().decode("ASCII")' [...] It's so long!
You can use:
command_stdout.decode()
decode() has a standard argument:
decode()
codecs.decode(obj, encoding='utf-8', errors='strict')