How to find elements by class

后端 未结 17 1645
有刺的猬
有刺的猬 2020-11-22 08:33

I\'m having trouble parsing HTML elements with \"class\" attribute using Beautifulsoup. The code looks like this

soup = BeautifulSoup(sdata)
mydivs = soup.fi         


        
17条回答
  •  一个人的身影
    2020-11-22 08:57

    Update: 2016 In the latest version of beautifulsoup, the method 'findAll' has been renamed to 'find_all'. Link to official documentation

    Hence the answer will be

    soup.find_all("html_element", class_="your_class_name")
    

提交回复
热议问题