phtyon读取pdf的远程地址解析内容

import xlwt,pymysql,requests,json,datetime,PyPDF2,urllib.request,io,ssl

添加context 解决读取pdf时SSL报错问题

context = ssl._create_unverified_context()

读取pdf地址 获取pdf内容

req = urllib.request.urlopen(contract_download_url,context=context)

remote_file=req.read()

memory_file = io.BytesIO(remote_file)

read_pdf = PyPDF2.PdfReader(memory_file)

获取pdf页数

number_of_pages = len(read_pdf.pages)

for i in range(0, number_of_pages):

pageObj = read_pdf.pagesi

获取当前页数的pdf内容

page = pageObj.extract_text()

处理后续业务流程 .......................

相关推荐
金銀銅鐵13 分钟前
用 Tkinter 实现简单的猜数字游戏
后端·python
copyer_xyf30 分钟前
Python 模块与包的导入导出
前端·后端·python
ice8130331811 小时前
【Python】Matplotlib折线图绘制
开发语言·python·matplotlib
copyer_xyf1 小时前
Python venv 虚拟环境
前端·后端·python
林爷万福2 小时前
GitHub 开源光谱数据处理项目推荐
python·光纤光谱仪
copyer_xyf2 小时前
Python 如何同时做很多事:进程、线程、协程
前端·后端·python
Full Stack Developme3 小时前
Spring Bean 依赖注入
python·spring·log4j
yuhuofei20213 小时前
【Python入门】Python中的元组tuple
python
清水白石0083 小时前
从菱形继承到 `super()`:彻底理解 Python MRO 与多继承方法查找机制
开发语言·python
CTA终结者4 小时前
期货量化下单前资金怎么核对:天勤 get_account 与可用、权益字段
python·区块链