Answer the question
In order to leave comments, you need to log in
How to parse the span attribute?
Good afternoon, from this code you need to parse only the value "House", how to do this? Thank you.
<ul class="product-item_params">
<li>
<span class="product-item_params_name">Бренд:</span>
<span class="product-item_params_value">Домик </span>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
from bs4 import BeautifulSoup
soup = BeautifulSoup('''<html lang="en"><body><ul class="product-item_params">
<li>
<span class="product-item_params_name">Бренд:</span>
<span class="product-item_params_value">Домик </span>
</li>
</ul></body></html>''', 'html.parser')
print(soup.find('span', {'class': 'product-item_params_value'}).text)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question