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

安装

pip install python-pptx -i https://pypi.tuna.tsinghua.edu.cn/simple --ignore-installed

pptx 解析代码实现

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

你可能感兴趣的:(Python,python,ppt)