0
我在BeautifulSoup的幫助下創建了一個python腳本,我可以從一個網站獲取一些內容。在html body標籤內添加內容
現在我想用這個腳本將代碼放在html文件的body標籤內。
我該怎麼做?
日Thnx
我在BeautifulSoup的幫助下創建了一個python腳本,我可以從一個網站獲取一些內容。在html body標籤內添加內容
現在我想用這個腳本將代碼放在html文件的body標籤內。
我該怎麼做?
日Thnx
soup = BeautifulSoup(your_old_html)
soup.body.insert(0, your_tag)
print soup
此處瞭解詳情: http://www.crummy.com/software/BeautifulSoup/documentation.html#Adding%20a%20Brand%20New%20Element