0
我在與BeautifulSoup混淆,發現它偶爾只需要很長的時間來解析一個頁面,儘管沒有任何代碼或連接的變化。有任何想法嗎?BeautifulSoup結冰
from bs4 import BeautifulSoup
from urllib2 import urlopen
#The particular state website:
site = "http://sfbay.craigslist.org/rea/"
html = urlopen(site)
print "Done"
soup = BeautifulSoup(html)
print "Done"
#Get first 100 list of postings:
postings = soup('p')
不回答你的問題(我相信答案是 - 這是你的互聯網):我會注意到'html'實際上不是HTML - 只是連接...你需要使用'.read()'來獲取數據...... –
謝謝。這就是訣竅:) –