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)
相关推荐
赵谨言15 小时前
基于Python的汽车CAN总线报文格式转换系统的设计与实现
大数据·开发语言·经验分享·笔记·python
坚持就完事了15 小时前
Python各种命名规则
开发语言·python
郝学胜-神的一滴15 小时前
Python中的del语句与垃圾回收机制深度解析
服务器·开发语言·网络·python·算法
DanCheng-studio15 小时前
信息安全毕设易上手课题怎么选
python·毕业设计·毕设
DanCheng-studio15 小时前
毕设开源 大数据B站数据分析与可视化
python·毕业设计·毕设
软件资深者15 小时前
2026 版初中几何辅助线教材 PDF|打印即提分,中考几何 “分水岭” 一键通关
学习·数学·pdf·教学·初中数学
那个松鼠很眼熟w15 小时前
python fastapi 快速创建web应用
python·fastapi
速易达网络15 小时前
AI学习路径 python到openclaw
人工智能·python·学习
Java后端的Ai之路16 小时前
在一个 Python 脚本中导入另一个脚本的功能
服务器·开发语言·python
SeatuneWrite16 小时前
**手机专业写剧本软件哪家可靠2025推荐,适配多场景创作与
人工智能·python·智能手机