惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 逸乐太子

高效办公神器:可视化Excel文档合并工具,告别手动复制粘贴 全国分省 Excel 爬取后,一键统计全文件数据行数|附即用型统计工具 某速体育网站中canvas数据获取 台风数据采集全攻略:从数据源到实操落地 豆包生成的图片带有AI字样怎么去除? 中国马拉松官方网站赛历信息采集工具 国家标准批量采集工具:全量元数据检索 + 批量导出 知网文献批量采集:BibTeX/EndNote 完整导出(含摘要、关键词、被引、全文链接) 超级课堂题库下载本地工具 洋葱智课在线题库导出工具 【python爬虫定制】PubScholar公益学术平台期刊名称爬取 【python数据采集】阳光高考学校信息采集 python程序的守护工具 【Python数据采集】国家自然科学基金大数据知识管理服务门户数据采集 pyinstaller 打包时第三方模块与图片资源加载 使用python爬取豆瓣电影短评评论内容 使用 js 实现 urljoin 方法 使用 Python 爬取高校教师信息 python爬虫之JS逆向某易云音乐 国务院办公厅放假通知信息获取 - 逸乐太子 python爬虫之JS逆向 python爬虫之企某科技JS逆向 - 逸乐太子 linux下telnet命令有时无法退出 - 逸乐太子 H5中腾讯地图定位信息在安卓手机中获取不到
python从PDF文件中读取国民经济行业分类
逸乐太子 · 2023-03-15 · via 博客园 - 逸乐太子

返回主页

逸乐太子

世界那么大,我想去看看。

需求:

从中华人民共和国国家标准之国民经济行业分类文件中读取解析出国民经济行业分类和代码。

目标:

从标准 PDF 文件中读取出行业分类中的门类、大类、中类、小类、类别名称信息。

准备工作:

1.python 开发环境

2.国民经济行业分类.pdf

代码:

第一步:从 pdf 中先找到需要的数据在哪些页面

第二步:从 pdf 中解析出表格数据

```
def get_pdf_table(pdf_name, page_index):
    with pdfplumber.open(pdf_name) as pdf_info:  # 打开pdf文件
        page_one = pdf_info.pages[page_index]  # 选择第一页
        page_table = page_one.extract_tables()
        return page_table
```

第三步:
解析 table 中的数据。

最终生成效果如下:

UntitledImage

posted @ 2023-03-15 22:50  逸乐太子  阅读(194)  评论(8)    收藏  举报

公告