一般情况下,我们读取网页分析去返回内容时是这样子的:
#!/usr/bin/python
#coding:utf-8
import urllib2
headers = {"User-Agent": 'Opera/9.25 (Windows NT 5.1; U; en)'}
request = urllib2.Request(url='http://www.baidu.com', headers=headers)
response = urllib2.urlopen(request).read()
百度一下,你就知道