使用python优雅的将PDF转为Word

使用python优雅的将PDF转为Word

先装这个优雅的库

python 复制代码
pip install pdf2docx

然后运行下面优雅的代码,将pdf路径和docx路径修改

python 复制代码
from pdf2docx import Converter
# path
pdf_file = 'C:\\Users\\phl\\Desktop\\软件工程期末\\软件工程模拟试题5.pdf'
docx_file = 'C:\\Users\\phl\\Desktop\\软件工程期末\\软件工程模拟试题5.docx'

# convert pdf to docx
cv = Converter(pdf_file)
cv.convert(docx_file, start=0, end=None)
cv.close()

效果

相关推荐
Am-Chestnuts1 小时前
国产AI多轮对话归档与多格式导出实践
人工智能·word
_Jimmy_5 小时前
Agent 溯源精度提升方案
人工智能·python·langchain
SamChan906 小时前
在Web应用中集成PDF多语言翻译功能:PDFTranslator API实战指南
前端·python·ai·pdf·yapi·机器翻译
天天进步20156 小时前
Python全栈项目--智能办公自动化系统
开发语言·python
颜酱6 小时前
09 | 重构项目结构
人工智能·python·langchain
kisloy7 小时前
【爬虫入门第8讲】Python爬虫反爬入门
开发语言·爬虫·python
Sisphusssss8 小时前
香橙派5plus GPIO
linux·python·ubuntu
颜酱9 小时前
08 | 把维度值同步到 Elasticsearch(生成阶段)
人工智能·python·langchain
久久学姐9 小时前
基础转码学 AI:Java+Python 双语言入门,3 个月可落地实战项目
java·python·ai·转码·实战项目
ZHOU_WUYI9 小时前
4. light wam 模型loss计算过程
开发语言·人工智能·python