Convert
to end line

前端 未结 6 1820
别跟我提以往
别跟我提以往 2020-12-08 19:00

I\'m trying to extract some text using BeautifulSoup. I\'m using get_text() function for this purpose.

My problem is that the text contain

6条回答
  •  情歌与酒
    2020-12-08 19:28

    Adding to Ian's and dividebyzero's post/comments you can do this to efficiently filter/replace many tags in one go:

    for elem in soup.find_all(["a", "p", "div", "h3", "br"]):
        elem.replace_with(elem.text + "\n\n")
    

提交回复
热议问题