python运行命令行的输出结果,并处理中文乱码

res = os.popen("cmd命令")
tempstream = res._stream

print(tempstream.buffer.read().decode(encoding='utf-8'))

s = tempstream.buffer.read().decode(encoding='utf-8')
之后得到就是字符串了,可以正则取我们的结果

原文地址:https://www.cnblogs.com/itBlogToYpl/p/12736305.html