終于搞定了 下載這里的代碼
https://github.com/lovefengruoqing/baike_spider
需要爬多少條數(shù)據(jù)在count= 這里改
運(yùn)行之后點(diǎn)index.html打開瀏覽器就可以,而不是output.html
https://github.com/lovefengruoqing/baike_spider
需要爬多少條數(shù)據(jù)在count= 這里改
運(yùn)行之后點(diǎn)index.html打開瀏覽器就可以,而不是output.html
2019-05-18
python2.0版本導(dǎo)入cookielib直接import cookielib
python 3.6 改成 http.cookiejar了
python 3.6 改成 http.cookiejar了
2019-05-16
urllib2 在 python3.x 中被改為urllib.request
2019-05-16
python2.7
第三種方法
print '第三種方法'
#import http.cookiejar
import cookielib
cj=cookielib.CookieJar()
opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
response3=urllib2.urlopen(url)
print response3.getcode()
print response3.read()
print '\n\n\n\n\n'
print cj
第三種方法
print '第三種方法'
#import http.cookiejar
import cookielib
cj=cookielib.CookieJar()
opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
response3=urllib2.urlopen(url)
print response3.getcode()
print response3.read()
print '\n\n\n\n\n'
print cj
2019-05-13