gpt4 book ai didi

Python:将 PDF 转换为 DOC

转载 作者:太空狗 更新时间:2023-10-29 20:47:32 24 4
gpt4 key购买 nike

如何将 pdf 文件转换为 docx。有没有办法使用 python 来做到这一点?

我看到一些页面允许用户上传 PDF 并返回一个 DOC 文件,例如 PdfToWord

提前致谢

最佳答案

如果您安装了 LibreOffice

lowriter --invisible --convert-to doc '/your/file.pdf'

如果你想为此使用 Python:

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)

关于Python:将 PDF 转换为 DOC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26358281/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com