开发者

Add content inside html body tag

开发者 https://www.devze.com 2023-02-15 03:52 出处:网络
i created a pyth开发者_StackOverflowon script with the help of BeautifulSoup and i can get some content from a web site.

i created a pyth开发者_StackOverflowon script with the help of BeautifulSoup and i can get some content from a web site.

Now i want with this script to place the code inside the body tag of an html file.

How am i gonna do that ?

thnx


soup = BeautifulSoup(your_old_html)
soup.body.insert(0, your_tag)
print soup

More info here: http://www.crummy.com/software/BeautifulSoup/documentation.html#Adding%20a%20Brand%20New%20Element

0

精彩评论

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