我正在尝试使用BeautifulSoup在一个网站上获取一个带有特殊id的号码。这是我的代码
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())但是我得到的'AttributeError:'ResultSet‘对象没有’get _text‘属性。问题出在哪里?
发布于 2016-08-11 04:33:40
ResultSet有点像一个列表,所以你需要做一些select[0].get_text()之类的事情。
更多信息请点击这里:Beautiful Soup: 'ResultSet' object has no attribute 'find_all'?
https://stackoverflow.com/questions/38882998
复制相似问题