已采納回答 / 螞蟻帥帥
正常情況下html.parser默認(rèn)是具備的,出現(xiàn)這種錯誤,可以檢查一下bs的版本和python的版本,是不是適配。在http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser這個鏈接可以看到,Python’s html.parser?Not very lenient (before Python 2.7.3 or 3.2.2)請檢查下Python的版本吧 ? ?
2015-12-18
老師 cmd報錯了
Command python setup.py egg_info failed with error code 1 in c:\users\yl\appdata
\local\temp\pip-build-yl\beautifulsoup4
Storing complete log in C:\Users\yl\pip\pip.log
Command python setup.py egg_info failed with error code 1 in c:\users\yl\appdata
\local\temp\pip-build-yl\beautifulsoup4
Storing complete log in C:\Users\yl\pip\pip.log
2015-12-18
對于Python 3.x,代碼需要做相應(yīng)改變:
import urllib.request
resp = urllib.request.urlopen('http://www.baidu.com')
print(resp.getcode())
import urllib.request
resp = urllib.request.urlopen('http://www.baidu.com')
print(resp.getcode())
2015-12-18
想要用最簡單的方式實現(xiàn)對數(shù)據(jù)庫有效數(shù)據(jù)的爬去,并進行清洗與處理,期待更多相關(guān)知識學(xué)習(xí)
2015-12-18
Python網(wǎng)頁下載器有:
* urllib2 (Python官方基礎(chǔ)模塊)
* requests (第三方包,更強大)
* urllib2 (Python官方基礎(chǔ)模塊)
* requests (第三方包,更強大)
2015-12-18