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)
相关推荐
DFT计算杂谈1 分钟前
VASP新手入门: IVDW 色散修正参数
linux·运维·服务器·python·算法
庚昀◟10 分钟前
ClaudeCode安装教程,基础使用、进阶推荐
人工智能·python·ai
deephub21 分钟前
告别脆弱的单体应用,用多智能体网络构建稳定的生产力工具
人工智能·python·大语言模型·多智能体
烟雨江南aabb23 分钟前
Python第六弹:python爬虫篇:什么是爬虫
开发语言·爬虫·python
MomentYY26 分钟前
第 1 篇:Agent 到底是什么?别被概念唬住了
人工智能·python·agent
Python大数据分析@34 分钟前
对你而言, Vibe Coding 的乐趣是什么?
python
WL_Aurora34 分钟前
Python 算法基础篇之排序算法(一):冒泡、选择、插入
python·算法·排序算法
龙腾AI白云35 分钟前
中国人工智能培训网—AI系列录播课
python·beautifulsoup
AI算法沐枫37 分钟前
大一学生如何入门机器学习,深度学习,学习顺序如何?
人工智能·python·深度学习·学习·线性代数·算法·机器学习
用户67570498850241 分钟前
Python 统一大业:uv 如何整合 Pip、Pyenv 和 Venv?
后端·python