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/
英文文档
中文文档

相关推荐
2501_9444522314 小时前
字数统计 Cordova 与 OpenHarmony 混合开发实战
python
骚戴14 小时前
2025 Python AI 实战:零基础调用 LLM API 开发指南
人工智能·python·大模型·llm·api·ai gateway
kobe_OKOK_15 小时前
tdeinge REST API 客户端
python·缓存·django
io_T_T15 小时前
Python os库 os.walk使用(详细教程、带实践)
python
TonyLee01716 小时前
使用argparse模块以及shell脚本
python
Blossom.11816 小时前
Prompt工程与思维链优化实战:从零构建动态Few-Shot与CoT推理引擎
人工智能·分布式·python·智能手机·django·prompt·边缘计算
love530love18 小时前
Windows 11 下 Z-Image-Turbo 完整部署与 Flash Attention 2.8.3 本地编译复盘
人工智能·windows·python·aigc·flash-attn·z-image·cuda加速
MediaTea18 小时前
Python:模块 __dict__ 详解
开发语言·前端·数据库·python
jarreyer18 小时前
python,numpy,pandas和matplotlib版本对应关系
python·numpy·pandas
代码or搬砖19 小时前
HashMap源码
开发语言·python·哈希算法