不完全的。创建
Request对象实际上并不发送请求,并且Request对象没有
Read()方法。(还:
read()是小写字母。)您需要做的就是将
Request用作第一个参数
urlopen(),这将给您您的答复。
import urllib2request = urllib2.Request("http://www.google.com", headers={"Accept" : "text/html"})contents = urllib2.urlopen(request).read()


