LINUX.ORG.RU

История изменений

Исправление E, (текущая версия) :

Вместо soup.find() теперь нужно использовать soup.select().

import bs4

text = """<html>
<body>
<h1 class="title">Title</h1>
<h1 class="title">Another title</h1>
</body>
</html>
"""

soup = bs4.BeautifulSoup(text, 'lxml')
print(soup.select('h1.title'))
$ python test.py
[<h1 class="title">Title</h1>, <h1 class="title">Another title</h1>]

Исходная версия E, :

Вместо soup.find() теперь нужно использовать soup.select().