关于文档的问题

2011-03-03 22:19:54 +08:00
 kingwkb
今天看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

是因为文档不全吗?还是我的方法不正确?
4432 次点击
所在节点    Python
3 条回复
kingwkb
2011-03-12 10:24:27 +08:00
没人给我说一下吗?
lepture
2011-03-12 10:58:32 +08:00
@kingwkb help(urllib2)
lepture
2011-03-12 10:59:14 +08:00
@kingwkb 学会用 help 和 dir

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/9237

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX