getpre()方法(在python2.6中添加)返回与响应一起发送的HTTP状态代码;如果URL不是HTTP URL,则返回None。
>>> a=urllib.urlopen('http://www.google.com/asdfsf')>>> a.getpre()404>>> a=urllib.urlopen('http://www.google.com/')>>> a.getpre()200
getpre()方法(在python2.6中添加)返回与响应一起发送的HTTP状态代码;如果URL不是HTTP URL,则返回None。
>>> a=urllib.urlopen('http://www.google.com/asdfsf')>>> a.getpre()404>>> a=urllib.urlopen('http://www.google.com/')>>> a.getpre()200