Beautiful Soup and extracting a div and its contents by ID

后端 未结 13 1541
死守一世寂寞
死守一世寂寞 2020-11-30 19:54
soup.find(\"tagName\", { \"id\" : \"articlebody\" })

Why does this NOT return the

...
tags
13条回答
  •  星月不相逢
    2020-11-30 20:22

    The Id property is always uniquely identified. That means you can use it directly without even specifying the element. Therefore, it is a plus point if your elements have it to parse through the content.

    divEle = soup.find(id = "articlebody")
    

提交回复
热议问题