Python初識(四)

 Pip install beautifulsoup4

Beautifulsoup4的安裝小測

演示HTML頁面地址:http://python123.io/ws/demo.html

 

Beautiful soup

 

From bs4 import BeautifulSoup

Soup=BeautifulSoup(“<html>data<html>”,”html.parser”)

#可以打開文件進行解析html 代碼

Soup2=BeautifulSoup(open(“D://demo.html”),”html.parser”)

 

獲得tag標籤的方法:

                 編譯器

源代碼                                           目標代碼

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章