2016-08-11 26 views
-4

我試圖抓取CL頁面的內容,並使用python的BeautifulSoup將其顯示爲單獨的html頁面。抓取craigslist結果使用python的「找不到頁面」

但它導致「頁面未找到」。

d={'query':'doctor'} 
encoder=urllib.urlencode(d).encode('ASCII') 
page1=urllib.urlopen('chennai.craigslist.co.in/search',encoder) 
content=page1.read() 
file1=open("r.html",'w') 
file1.write(content.decode()) 
+0

你必須表現出一定的代碼 – DeepSpace

+0

d = { '查詢': '醫生'} 編碼器= urllib.urlencode(d).encode( 'ASCII') 第1頁=了urllib.urlopen(的「http:// chennai.craigslist.co.in/search'encoder) content = page1.read() file1 = open(「r.html」,'w') file1.write(content.decode()) –

+0

^請編輯您的(格式)代碼到問題中,謝謝。 – halfer

回答

-1

該代碼在python版本3中工作..感謝您的貢獻。