Python代码优雅解析PDF文件

主要功能:利用Python扩展库pdfplumber解析中文核心期刊要目总览.pdf文件成excel文件

解析文件:中文核心期刊要目总览.pdf

官方文档:pdfplumber · PyPI

具体代码:

python 复制代码
import pdfplumber
import pandas as pd

with pdfplumber.open("hexin.pdf") as pdf:
    print(len(pdf.pages))
    first = pdf.pages[0]
    ftable = first.extract_table()
    tables = ftable[2:]
    for page in pdf.pages[1:]:
        tables += page.extract_table()
    data_frame = pd.DataFrame(tables, columns=ftable[1])
    with pd.ExcelWriter('hexin.xlsx') as excel:
        data_frame.to_excel(excel, index=False)
相关推荐
高洁013 小时前
多源数据融合:把零散信号拼成一致图景
人工智能·python·机器学习·transformer·迁移学习
前端fighter3 小时前
2026年前端面试题总结(pdf版)
前端·pdf
郝学胜-神的一滴3 小时前
Effective Python 条款41:试Mix‑In组合式开发
开发语言·pytorch·python·pycharm·numpy
吃我一窝jio3 小时前
Python与Redis集合深度解析
开发语言·redis·笔记·python
龙腾AI白云5 小时前
多源数据融合:把零散信号拼成一致图景
大数据·人工智能·python·机器学习·知识图谱
艾派森6 小时前
深度学习实战-基于VGG19的健康和白化珊瑚图像分类识别模型
人工智能·python·深度学习·分类
鲸渔6 小时前
【AI Agent系列课程26-Python 基础26】复盘:Python 接口开发知识清单
开发语言·python·ai编程
2401_868534787 小时前
55 个热门网络面试问题及答案
网络·python
aifannihao7 小时前
ON CONFLICT 冲突后返回空:sqlite3 实测 get-or-create
数据库·python·postgresql·sqlite3·标准库
用户0332126663677 小时前
使用 Python 合并 Excel 工作簿
python