Python 子进程输出混乱

Python subprocess Messy output

使用以下代码:

output = subprocess.check_output(['wmic', 'PATH', 'Win32_videocontroller', 'GET', 'description'])
    print(output , "\n")

我得到下一个输出:

b'Description                \r\r\nNVIDIA GeForce 710M        \r\r\nIntel(R) HD Graphics 4000  \r\r\n\r\r\n'

当我在我的 CMD 中使用突击队 wmic path win32_videocontroller get desription 时,我只得到显卡信息。这在 python 中也可能吗?没有 /r/r/r/r 东西?

使用translate

print output.translate(None, '\r\n')

调用函数时使用参数"universal_newlines=True":

output = subprocess.check_output(['wmic', 'PATH', 'Win32_videocontroller',  'GET', 'description'], universal_newlines=True)
print(output , "\n")