This topic created in 5546 days ago, the information mentioned may be changed or developed.
今天看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 replies • 1970-01-01 08:00:00 +08:00