我如何在python中阅读pdf? [英] How can i read pdf in python?

查看:157
本文介绍了我如何在python中阅读pdf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在python中阅读pdf? 我知道一种将其转换为文本的方法,但是我想直接从pdf中读取内容.

How can i read pdf in python? I know one way of converting it to text, but i want to read the content directly from pdf.

任何人都可以解释python中哪个模块最适合pdf提取

Can anyone explain which module in python is best for pdf extraction

推荐答案

您可以使用PyPDF2软件包

You can USE PyPDF2 package

#install pyDF2
pip install PyPDF2

# importing all the required modules
import PyPDF2

# creating an object 
file = open('example.pdf', 'rb')

# creating a pdf reader object
fileReader = PyPDF2.PdfFileReader(file)

# print the number of pages in pdf file
print(fileReader.numPages)

遵循此文档 http://pythonhosted.org/PyPDF2/

这篇关于我如何在python中阅读pdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆