Answer the question
In order to leave comments, you need to log in
How to move to the next element under the same bs4 class?
I scrape a page in VK, got to the location, and in order to parse the name of the city, the following picture is displayed (photo below), and here I need to parse the second labeled, here is my solution
for item in items:
place = item.find('div', class_='profile_info')
if place:
place = place.find('div', class_='clear_fix').nextSibling().find('div', class_='labeled').find('a').get_text()
else:
print('не указан')
AttributeError: ResultSet object has no attribute 'find'. You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?
Answer the question
In order to leave comments, you need to log in
Just check the intermediate results, why try to immediately swallow a huge piece of
print
place = place.find('div', class_='clear_fix').nextSibling()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question