小编Als*_*lso的帖子

使用 Python 将 PDF 转换为 .docx

我正在尝试找到一种使用 Python 将 PDF 文件转换为 .docx 文件的方法。

我看过与此相关的其他帖子,但在我的情况下,它们似乎都不能正常工作。

我专门用

import os
import subprocess

for top, dirs, files in os.walk('/my/pdf/folder'):
    for filename in files:
        if filename.endswith('.pdf'):
            abspath = os.path.join(top, filename)
            subprocess.call('lowriter --invisible --convert-to doc "{}"'
                            .format(abspath), shell=True)
Run Code Online (Sandbox Code Playgroud)

这给了我输出[1],但是,我在文件夹中找不到任何 .docx 文档。

我安装了 LibreOffice 5.3。

有什么线索吗?

先感谢您!

python pdf doc docx libreoffice

5
推荐指数
2
解决办法
4万
查看次数

标签 统计

doc ×1

docx ×1

libreoffice ×1

pdf ×1

python ×1