pptx 文件版面分析-- python-pptx(python 文档解析提取)

安装

sql 复制代码
pip install python-pptx -i https://pypi.tuna.tsinghua.edu.cn/simple --ignore-installed

pptx 解析代码实现

python 复制代码
from pptx import Presentation
file_name = "rag_pptx/test1.pptx"
# 打开.pptx文件
ppt = Presentation(file_name)
for slide in ppt.slides:
	#print(slide)
	for shape in slide.shapes:
		if shape.has_text_frame:
			text_frame = shape.text_frame
			print(text_frame.text)

参考
【非一般程序员训练营 第二季 ------ RAG 潘多拉宝盒 任务二 版面分析模块】
python-pptx库中文文档及使用样例
pypi/python-pptx/
英文文档
中文文档

相关推荐
孔丘闻言12 分钟前
关于 Flask 3.0+的 框架的一些复习差异点
python·adb·flask
ankleless12 分钟前
Python 数据可视化:Matplotlib 与 Seaborn 实战
开发语言·python
witkey_ak98961 小时前
python 可迭代对象相关知识点
开发语言·python
站大爷IP1 小时前
Python生成器与迭代器:从内存优化到协程调度的深度实践
python
二闹1 小时前
Python打印值的两种写法,到底有啥不同?
python
站大爷IP2 小时前
Python构建MCP服务器:从工具封装到AI集成的全流程实践
python
深盾安全3 小时前
Python 装饰器详解
python
前端小趴菜054 小时前
python - 数据类型转换
python
跟橙姐学代码4 小时前
学Python必须迈过的一道坎:类和对象到底是什么鬼?
前端·python
卡洛斯(编程版4 小时前
(1) 哈希表全思路-20天刷完Leetcode Hot 100计划
python·算法·leetcode