MyAlphaSoup = BeautifulSoup(website_to_crawl.text, 'html.parser')
MyAlphaSoup.prettify()
MyAlphaAlphaSoup = MyAlphaSoup.find_all("div", {"class": "lister-item featurefilm"})
MyAlphaAlphaSoup.prettify()
我在第四行出错了
raise AttributeError( AttributeError: ResultSet object has no attribute 'prettify'. You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?
难道汤不都只是把汤缩小到一个较小的子集吗?所以类型没有改变
这是因为函数find_all返回一个列表。因此,如果指定列表的元素或循环,您应该能够做到这一点:
此外,还有一个惯例,即只对类使用首字母大写
相关问题 更多 >
编程相关推荐