※ 引述《plom (plom)》之銘言:
: 剛又試了一下
: import httplib
: httplib.HTTPConnection.debuglevel = 1
: import urllib2
: opener = urllib2.build_opener()
: opener.addheaders = [('User-agent', 'Mozilla/5.0')]
: opener.open('http://www.google.com.tw/search?q=time&start=20&complete=1&hl=zh-TW&sa=N&btnG=%E6%90%9C%E5%B0%8B').read()
: 接下來要下什麼指令才能抓網頁呢?
其實你上面已經抓到了啊
t = opener.open('http://www.google.com.tw/...........')
print t
就可以看到結果了
我把你的碼複製 try 過了沒問題..
很確實的抓到了網頁...
只是 parse 還要點力氣...
--
To iterate is human, to recurse is divine.
遞迴只應天上有, 凡人該當用迴圈. L. Peter Deutsch
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.78.40