由于想比较同一个网页中某个标签下的子节点的的相似度。
操作对象只是html标签,所以想先删除html中标签之外的文字,以排除干扰。
请问,有什么比较高效快捷的解决方法吗?
注:目前只想到使用正则来解决
由于想比较同一个网页中某个标签下的子节点的的相似度。
操作对象只是html标签,所以想先删除html中标签之外的文字,以排除干扰。
请问,有什么比较高效快捷的解决方法吗?
注:目前只想到使用正则来解决
http://snipplr.com/view/50835/stripremove-html-tags-django-utils/
# import the strip_tags
from django.utils.html import strip_tags
# simple string with html inside.
html = '<p>paragraph</p>'
print html # will produce: <p>paragraph</p>
stripped = strip_tags(html)
print stripped # will produce: paragraph
4 回答4.5k 阅读✓ 已解决
1 回答3.3k 阅读✓ 已解决
4 回答3.8k 阅读✓ 已解决
3 回答2.2k 阅读✓ 已解决
1 回答4.5k 阅读✓ 已解决
1 回答3.9k 阅读✓ 已解决
1 回答2.8k 阅读✓ 已解决
HTMLParser 够用了