PDF表格解析
使用到的python库
pdfplumber,io
提取目标
http://yjgl.tj.gov.cn/ZWFW5050/bjjggs1/202202/W020220216348928027515.pdf
http://yjgl.tj.gov.cn/ZWFW5050/bjjggs1/202201/W020220130595559114737.pdf
http://yjgl.tj.gov.cn/ZWFW5050/bjjggs1/202201/W020220130595121321067.pdf
过程说明
通过爬取对应pdf文件,将其二进制数据写入内存,通过io的BytesIO对象,实现内存读取,之后通过pdfplumber加载,最终实现对pdf文件的操作
代码展示
import pdfplumber
import re
import io
import requests
def pdf_parse():
url = 'http://yjgl.tj.gov.cn/ZWFW5050/bjjggs1/202201/W020220130595559114737.pdf'
resp = requests.get(url, stream=True)
resp.encodi