The make your error,size is a string.
One way to do it:
>>> size = '' >>> size.find_next_sibling('span')
Error:Traceback (most recent call last):
File "<string>", line 301, in runcode
File "<interactive input>", line 1, in <module>
AttributeError: 'str' object has no attribute 'find_next_sibling'
Try to post better formatted HTML,Both CodePen and JSFiddle has Tidy HTML function.One way to do it:
from bs4 import BeautifulSoup html = '''\ <ul class="properties-list"> <li> 3067 JH Rotterdam <span class="item-sold-label-small" title="Verkocht">Verkocht</span> </li> <li> <span title="Woonoppervlakte">90 m²</span> <span title="Aantal kamers">4 kamers</span> </li>''' soup = BeautifulSoup(html, 'lxml') p_lst = soup.find(class_="properties-list") span = p_lst.select('li > span') print([item.text for item in span[1:]])
Output:['90 m²', '4 kamers']