【发布时间】:2014-12-28 13:45:26
【问题描述】:
我正在使用 feedparser 开发一个脚本(用于提取 RSS 提要)。 使用一些函数,我最终得到了一个名为 description 的字符串,如下所示:
"This is the description of the feed. < img alt='' height='1' src='http://linkOfARandomImage.of/the/feed' width='1' />"
html标签可以变化,我可以有img,a href,“p”,“h1”,......而且数量也可能不同。所以它们是相当随机的。但我想做的只是保留第一个文本。 我想知道是否有办法删除所有标签,我正在考虑做类似的事情:从这个字符“
【问题讨论】:
标签: python html tags feedparser