Convert bytes to a string

后端 未结 19 2235
野性不改
野性不改 2020-11-21 04:45

I\'m using this code to get standard output from an external program:

>>> from subprocess import *
>>> command_stdout = Popen([\'ls\', \'-l         


        
19条回答
  •  臣服心动
    2020-11-21 05:05

    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').

提交回复
热议问题