search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

BeautifulSoup 常用的網頁解析器 - Python 教學筆記本



# BeautifulSoup 常用的網頁解析器

BeautifulSoup(html, "html.parser") # → 速度中等,容錯率強,python內建資料庫
BeautifulSoup(html, "lxml") # → 速度快,但須裝C語言套件
BeautifulSoup(html, "xml") # → 速度快,但須裝C語言套件
BeautifulSoup(html, "html5lib") # → 速度慢,容錯率最強,不須安裝額外套件

# 常見 error 

BeautifulSoup: object of type 'Response' has no len()

# 解決方法如下:
res = requests.get(url).content


熱門推薦

本文由 python-learnnotebookblogspotcom 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦