How can I use the python HTMLParser library to extract data from a specific div tag?

前端 未结 4 2245
名媛妹妹
名媛妹妹 2020-11-27 13:43

I am trying to get a value out of a HTML page using the python HTMLParser library. The value I want to get hold of is within this html element:

...
4条回答
  •  清歌不尽
    2020-11-27 13:46

    Have You tried BeautifulSoup ?

    from bs4 import BeautifulSoup
    soup = BeautifulSoup('
    20
    ') tag=soup.div print(tag.string)

    This gives You 20 on output.

提交回复
热议问题