Python 从url读取pptx文件内容

Python 从url读取pptx文件内容,python,Python,我找到了从url读取word文件内容的解决方案 从urllib.request导入urlopen 从bs4导入BeautifulSoup 从io导入字节io 从zipfile导入zipfile file=urlopen(url).read() file=BytesIO(文件) 文档=ZipFile(文件) content=document.read('word/document.xml') word_obj=beautifulsou(content.decode('utf-8')) text\u

我找到了从url读取word文件内容的解决方案

从urllib.request导入urlopen
从bs4导入BeautifulSoup
从io导入字节io
从zipfile导入zipfile
file=urlopen(url).read()
file=BytesIO(文件)
文档=ZipFile(文件)
content=document.read('word/document.xml')
word_obj=beautifulsou(content.decode('utf-8'))
text\u document=word\u obj.findAll('w:t')
对于文本文档中的t:
打印(t.text)

有人知道处理pptx文件的类似方法吗?我见过几种解决方案,但可以直接读取文件,而不是从url读取。

我不知道它是否能帮助您,但通过urllib,您可以获取pptx的内容(变量
文件
),在读取pptx文件路径的函数中使用
cStringIO.StringIO(文件)
,以模拟文件。

如果您可以从磁盘读取.pptx文件,而不是从url加载文件,然后使用该解决方案。