Reputation: 41
What is the BeautifulSoup method for retrieving text from an element. I haveprices = soup.find_all('p', class_='price_color')
and want to retrieve the text from prices. I tried p = prices.get_text()
but got an error stating: 'ResultSet' object has no attribute 'text'
Upvotes: 0
Views: 44
Reputation: 172
find_all
returns a ResultSet object and you can iterate that object using a for
loop.
You can try something such as:
for values in soup.find_all('p', class_='price_color'):
print values.text
Upvotes: 2