开发者

using BeautifulSoup to insert an element before closing body

开发者 https://www.devze.com 2023-01-27 22:39 出处:网络
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:

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

精彩评论

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