#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import cookielib
url = 'http://www.baidu.com'
print '第一種方法'
response1 = urllib2.urlopen(url)
print response1.getcode()
print len(response1.read())
# -*- coding: utf-8 -*-
import urllib2
import cookielib
url = 'http://www.baidu.com'
print '第一種方法'
response1 = urllib2.urlopen(url)
print response1.getcode()
print len(response1.read())
2016-05-09
關(guān)于200,可以百度200OK了解HTTP頭,感覺網(wǎng)絡(luò)基礎(chǔ)知識對學(xué)習(xí)爬蟲有所幫助
2016-05-05
我按照教程敲得示例代碼 ,能完整運行 ,有需要的可以參考。 https://github.com/devops/spider_baike.git
2016-05-04