【发布时间】:2018-09-15 22:51:15
【问题描述】:
我想改一下
def has_class_but_no_id(tag):
return tag.has_key('class') and not tag.has_key('id')
此函数来自 Python2 而非 Python3
我想到了
我在这样的列表中更改了这个 HTML 文档
list_of_descendants = list(soup.descendants)
所以我可以获得包含类但不包含 id 的标签
这是关于找到所有带有class = blabla... 但不是id = .... 的标签
我不知道我该如何处理这个问题
【问题讨论】:
标签: python python-3.x python-2.7 beautifulsoup web-crawler