这是一个创建于 5401 天前的主题,其中的信息可能已经有所发展或是发生改变。
今天看urllib2模块
urllib2.urlopen里面说
This function returns a file-like object with two additional methods:
geturl() return the URL of the resource retrieved, commonly used to determine if a redirect was followed
info() return the meta-information of the page, such as headers, in the form of an mimetools.Message instance (see Quick Reference to HTTP Headers)
返回的是一个类file对象,比file对象多了2个方法,实验一下info(),发现没有状态码,把urllib2的文档翻完了,还是找不到,google之后才找到原来是.code
是因为文档不全吗?还是我的方法不正确?
3 条回复 1970-01-01 08:00:00 +08:00  | | 1 kingwkb 2011-03-12 10:24:27 +08:00 没人给我说一下吗? |
 | | 2 lepture 2011-03-12 10:58:32 +08:00 |
 | | 3 lepture 2011-03-12 10:59:14 +08:00 |