willsonlincake 发表于 2022-4-3 00:09:41

Python读写LibreOffice Writer文档

LibreOffice Writer是一个开源的字处理工具,Word的替代品.Python利用odfpy库读写odt文档.
https://stackoverflow.com/questions/51054770/how-to-read-odt-using-python
代码:
from odf import text, teletype
from odf.opendocument import load
textdoc = load("your.odt")
allparas = textdoc.getElementsByType(text.P)
teletype.extractText(allparas)

蓝莓糖 发表于 2022-4-3 08:04:24

不错的分享,看发帖时间挺晚的啊
页: [1]
查看完整版本: Python读写LibreOffice Writer文档