Antiword将.doc转换为empy .txt文件

时间:2020-03-12 15:02:13

标签: python doc file-conversion

我是python的新手,正在尝试将.doc扩展名文件转换为包含Linux服务器上内容的.txt文件

我将linux目录的persion设置为777

在运行以下脚本时,返回具有644权限的空output_file.txt

请帮助我修复它

import os
import subprocess
from subprocess import call

input_word_file = "file500kb.docx"
output_text_file = "output_file.txt"
os.system('antiword %s > %s' % (input_word_file, output_text_file))
# subprocess.call('antiword %s > %s' % (input_word_file, output_text_file))
# call('antiword %s > %s' % (input_word_file, output_text_file))
# subprocess.check_output('antiword %s > %s' % (input_word_file, output_text_file))

我正在尝试注释中的os.system的替代方案。

0 个答案:

没有答案