0

I'm trying to use BeautifulSoup to get a number with a special id on a website. this is my code

from urllib2 import urlopen
from bs4 import BeautifulSoup
import requests, logging
logging.basicConfig()
html = urlopen("http://example.com")
bsObj = BeautifulSoup(str(html), "html.parser")
select = bsObj.findAll(id="myid")
print(select.get_text())

But I get the 'AttributeError: 'ResultSet' object has no attribute 'get_text''. Where is the problem?

0

1 Answer 1

2

ResultSet is kind of like a list, so you'd need to do select[0].get_text() or something.

More here: Beautiful Soup: 'ResultSet' object has no attribute 'find_all'?

2

Not the answer you're looking for? Browse other questions tagged or ask your own question.