推荐学习书目
› 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 · Mar 3, 2011 · 5320 views
    This topic created in 5688 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
    kingwkb
        1
    kingwkb  
    OP
       Mar 12, 2011
    没人给我说一下吗?
    lepture
        2
    lepture  
       Mar 12, 2011
    @kingwkb help(urllib2)
    lepture
        3
    lepture  
       Mar 12, 2011
    @kingwkb 学会用 help 和 dir
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2938 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 12:52 · PVG 20:52 · LAX 05:52 · JFK 08:52
    ♥ Do have faith in what you're doing.