美文网首页
如何匹配到多个标签中的所有文本

如何匹配到多个标签中的所有文本

作者: 想旅游的程序员 | 来源:发表于2018-11-26 11:14 被阅读0次
str1 = """<h6 class="post-footer">
                  作者:月光 | 分类:<a href="https://www.williamlong.info/cat/?cate=7" rel="category tag">网站建设</a> | 标签:<a href="https:
//www.williamlong.info/cat/?tags=Baidu" rel="tag">百度</a> | 评论:0 | 浏览:432 | <a href="https://www.williamlong.info/archives/5497.html">阅
读全文...</a>
        </h6>
"""
clean_text = BeautifulSoup(str1,'lxml').get_text().strip()
print(clean_text)

输出结果

作者:月光 | 分类:网站建设 | 标签:百度 | 评论:0 | 浏览:432 | 阅
读全文...

** 注:我的本意是使用正则进行匹配的,但是无法实现,有大佬知道的话,麻烦告知**

相关文章

网友评论

      本文标题:如何匹配到多个标签中的所有文本

      本文链接:https://www.haomeiwen.com/subject/sjnvqqtx.html