from pptx import Presentation
for pptx_filename in directory:
prs = Presentation(pptx_filename)
for slide in prs.slides:
for shape in slide.shapes:
print shape.text
from pptx import Presentation
import glob
for eachfile in glob.glob("*.pptx"):
prs = Presentation(eachfile)
print(eachfile)
print("----------------------")
for slide in prs.slides:
for shape in slide.shapes:
if hasattr(shape, "text"):
print(shape.text)
#!/usr/bin/env python
from tika import parser
parsed = parser.from_file('/path/to/file')
print(parsed["metadata"]) #To get the meta data of the file
print(parsed["content"]) # To get the content of the file
python-pptx
可用于执行您的建议。在较高的层次上,您可以这样做(不工作的代码,只是总体方法的想法):您需要添加一些关于搜索形状文本中的关键字符串并将它们添加到CSV文件或其他内容的信息,但是这种通用方法应该可以很好地工作。我把它留给你去解决更好的问题:)
实际工作
如果要提取文本:
提卡Python
Apache Tika库的Python端口,根据文档Apache Tika支持从1500多种文件格式中提取文本。
注意:它还可以与pyinstaller一起工作
使用pip安装:
示例:
链接到官方GitHub
相关问题 更多 >
编程相关推荐