Python 处理文本是一项非常常见的功能,本文整理了几种读取不同格式文本的案例,建议收藏备用!
-
提取 PDF 内容
-
提取 Word 内容
-
提取 Web 网页内容
-
读取 CSV 数据
-
读取Json 数据
1. 提取PDF内容
# pip install PyPDF2 安装 PyPDF2
import PyPDF2
from PyPDF2 import PdfFileReader
# Creating a pdf file object.
pdf = open("test.pdf", "rb")
# Creating pdf reader object.
pdf_reader = PyPDF2.PdfFileReader(pdf)
# Checking total number of pages in a pdf file.
print("Total number of Pages:", pdf_reader.numPages)
# Creating a page object.
page = pdf_reader.getPage(200
Python读取各种格式数据实战指南

这篇博客汇总了Python处理不同类型数据的案例,包括PDF、Word、网页、CSV和JSON,是值得收藏的实用教程。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



