Larz60+ Wrote:you need:Don't need that @Larz60+,i do not use the dictionary call way anymore.
results = soup.find('div', {'class': '_2RngUh'})
Because you can just copy
class
name direct for source code and just add class_
to make it work.Example:
from bs4 import BeautifulSoup html = '<div class="cities">London</div>' soup = BeautifulSoup(html, 'lxml')Usage:
# Only add _ >>> tag = soup.find(class_="cities") >>> tag.text 'London' >>> # A dictionary call need more changing of what is organically is and also need a div tag >>> tag = soup.find('div', {'class': 'cities'}) >>> tag.text 'London'