I_AM_YI
2022-05-20 18:01
采纳率: 100%
浏览 83
已结题

AttributeError: 'NoneType' object has no attribute 'ul'

def getTitleUrl(html):

bsobj = BeautifulSoup(html,'html.parser')
titleList = bsobj.find('div', attrs={"class":"list"}).ul.find_all("li")
for item in titleList:
    link = "http://www.nhc.gov.cn" + item.a["href"];
    title = item.a["title"]
    date = item.span.text
    yield title, link, date

1条回答 默认 最新

相关推荐 更多相似问题