find() after replaceWith() doesn't work (using BeautifulSoup)

前端 未结 3 1391
一生所求
一生所求 2021-01-02 21:53

Please consider the following python session:

>>> from BeautifulSoup import BeautifulSoup
>>> s = BeautifulSoup(\"

This is

3条回答
  •  长情又很酷
    2021-01-02 22:11

    Simpler answer : after your call to replaceWith, regenerate and clean s by calling s = BeautifulSoup(s.renderContents()). Then you can find again.

提交回复
热议问题