V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
kingwkb
V2EX  ›  Python

关于文档的问题

  •  
  •   kingwkb · 2011-03-03 22:19:54 +08:00 · 4426 次点击
    这是一个创建于 4801 天前的主题,其中的信息可能已经有所发展或是发生改变。
    今天看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
    kingwkb
        1
    kingwkb  
    OP
       2011-03-12 10:24:27 +08:00
    没人给我说一下吗?
    lepture
        2
    lepture  
       2011-03-12 10:58:32 +08:00
    @kingwkb help(urllib2)
    lepture
        3
    lepture  
       2011-03-12 10:59:14 +08:00
    @kingwkb 学会用 help 和 dir
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1081 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 22:36 · PVG 06:36 · LAX 15:36 · JFK 18:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.