开发者

using BeautifulSoup to insert an element before closing body

What is the most efficient way to insert an element as last one in the bod开发者_StackOverflow社区y of an HTML page?


See my answer to a previous question along the same lines:

  • Extract all <script> tags in an HTML page and append to the bottom of the document

The following should insert just fine:

soup.body.insert(len(soup.body.contents), yourelement)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜