使用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()
效果


