HTML代码处理 [英] HTML code processing

查看:95
本文介绍了HTML代码处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要处理一些HTML代码并删除示例中的标签:

I want to process some HTML code and remove the tags as in the example:

""p"是一个非常有趣的段落.结果是这是一个非常有趣的段落."

"<p><b>This</b> is a very interesting paragraph.</p>" results in "This is a very interesting paragraph."

我正在使用Python作为技术;您知道我可以用来删除HTML标签的任何框架吗?

I'm using Python as technology; do you know any framework I may use to remove the HTML tags?

谢谢!

推荐答案

此问题可能会对您有所帮助:

This question may help you: Strip HTML from strings in Python

无论选择哪种解决方案,我都建议避免使用正则表达式.在处理大字符串时它们可能很慢,可能由于无效的HTML而无法工作,并且使用正则表达式剥离HTML并不总是安全或可靠的.

No matter what solution you choose, I'd recommend avoiding regular expressions. They can be slow when processing large strings, they might not work due to invalid HTML, and stripping HTML with regex isn't always secure or reliable.

这篇关于HTML代码处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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