Extract element with no class attribute

前端 未结 2 2012
伪装坚强ぢ
伪装坚强ぢ 2020-12-15 03:51

I need to navigate to an html element of a particular type. However, there are many such elements of that type on the page, with many different classes.

I need one w

2条回答
  •  一个人的身影
    2020-12-15 04:22

    As of Beautiful Soup version 4.1.2, you can use the class_ keyword argument.

    To select an element without a class attribute, you can just specify None:

    soup.find_all(class_=None)
    

    Alternatively, specifying False also works:

    soup.find_all(class_=False)
    

提交回复
热议问题