欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

BeautifulSoup庫未寫明解析器警告

from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://www.pythonscraping.com/pages/page1.html")
bsObj = BeautifulSoup(html.read())
print(bsObj.h2)

代碼運(yùn)行之后警告如下:
UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

成都創(chuàng)新互聯(lián)公司主要為客戶提供服務(wù)項目涵蓋了網(wǎng)頁視覺設(shè)計、VI標(biāo)志設(shè)計、網(wǎng)絡(luò)營銷推廣、網(wǎng)站程序開發(fā)、HTML5響應(yīng)式網(wǎng)站建設(shè)公司移動網(wǎng)站建設(shè)、微商城、網(wǎng)站托管及企業(yè)網(wǎng)站維護(hù)、WEB系統(tǒng)開發(fā)、域名注冊、國內(nèi)外服務(wù)器租用、視頻、平面設(shè)計、SEO優(yōu)化排名。設(shè)計、前端、后端三個建站步驟的完善服務(wù)體系。一人跟蹤測試的建站服務(wù)標(biāo)準(zhǔn)。已經(jīng)為社區(qū)文化墻行業(yè)客戶提供了網(wǎng)站維護(hù)服務(wù)。

The code that caused this warning is on line 4 of the file D:/Python/venv/test8.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.

翻譯如下:
用戶警告:沒有顯式指定語法分析器,因此我使用了此系統(tǒng)的最佳可用HTML語法分析器(“l(fā)xml”)。這通常不是問題,但是如果您在另一個系統(tǒng)上運(yùn)行此代碼,或者在不同的虛擬環(huán)境中運(yùn)行此代碼,它可能會使用不同的解析器并表現(xiàn)出不同的行為。

導(dǎo)致此警告的代碼位于文件d:/python/venv/test8.py的第4行。要消除此警告,請將附加參數(shù)'features=“l(fā)xml”'傳遞給beautifulsoup構(gòu)造函數(shù)。

解決:指定解析器,一般使用'lxml'

from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://www.pythonscraping.com/pages/page1.html")
bsObj = BeautifulSoup(html.read(),'lxml')
print(bsObj.h2)

網(wǎng)站標(biāo)題:BeautifulSoup庫未寫明解析器警告
當(dāng)前路徑:http://chinadenli.net/article10/ppisdo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動態(tài)網(wǎng)站定制開發(fā)標(biāo)簽優(yōu)化ChatGPT企業(yè)網(wǎng)站制作網(wǎng)站導(dǎo)航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)