用python调用antiword将doc转换成txt,发现返回值有误

2024-05-19 07:58:23 发布

您现在位置:Python中文网/ 问答频道 /正文

问题描述

我用python调用antiword将doc转换成txt,发现返回值的中文值是乱码。在powershell上也是这样。但是可以调用gitbash。你知道吗

enter image description here

你知道吗环境:Windows平台,py3.6版

我试着改变语言环境并尝试反词的-m参数,但没有成功。你知道吗

相关代码

Pipe = subprocess.Popen(
         ['antiword', filename],
         Stdout=subprocess.PIPE,
         Stderr=subprocess.PIPE )

Stdout, stderr = pipe.communicate()
Return stdoutenter code here

Tags: txt语言doc环境windowsstdout平台subprocess

热门问题