python – 使用BeautifulSoup在关闭body之前插入元素

python – 使用BeautifulSoup在关闭body之前插入元素

将元素作为最后一个元素插入 HTML页面主体的最有效方法是什么? 按照相同的方式查看我对上一个问题的回答: Extract all script tags in an HTML page and append to the bottom of the document 以下应该插入正常: soup.body.insert(len(soup.body.contents