如何在 Python 中将 Word 文档转换为非常简单的 html? [英] How do you convert a Word Document into very simple html in Python?

查看:25
本文介绍了如何在 Python 中将 Word 文档转换为非常简单的 html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我时不时会收到一个 Word 文档,我必须将其显示为网页.我目前正在使用 Django 的 flatpages 通过抓取 MS Word 生成的 html 内容来实现这一点.生成的html很乱.有没有更好的方法可以生成非常简单的 html 来使用 Python 解决这个问题?

Every now and then I receive a Word Document that I have to display as a web page. I'm currently using Django's flatpages to achieve this by grabbing the html content generated by MS Word. The generated html is quite messy. Is there a better way that can generate very simple html to solve this issue using Python?

推荐答案

一个好的解决方案是上传到 Google Docs 并从中导出 html 版本.(必须有一个 api 吗?)

A good solution involves uploading into Google Docs and exporting the html version from it. (There must be an api for that?)

它做了很多清理";Beautiful Soup 可根据需要进行进一步更改.它是地球上最强大、最优雅的 html 解析库.

It does so many "clean ups"; Beautiful Soup down the road can be used to make any further changes, as appropriate. It is the most powerful and elegant html parsing library on the planet.

这是记者公司的已知标准.

This is a known standard for Journalist companies.

这篇关于如何在 Python 中将 Word 文档转换为非常简单的 html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆