推荐学习书目
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
ericbize
V2EX  ›  Python

请教各位大神一个问题

  •  
  •   ericbize · Jul 8, 2017 · 2404 views
    This topic created in 3255 days ago, the information mentioned may be changed or developed.
    for i in range(024,027):
    print i


    为什么输出的是
    20
    21
    22

    而不是
    24
    25
    26

    前面不加 0 却不会报错,怎么破???
    4 replies    2017-07-12 06:20:04 +08:00
    siguretto
        1
    siguretto  
       Jul 8, 2017 via iPhone   ❤️ 3
    8 进制
    lzhr
        2
    lzhr  
       Jul 8, 2017
    babywhisper
        3
    babywhisper  
       Jul 12, 2017   ❤️ 1
    学会 google 呀,骚年
    https://stackoverflow.com/questions/11620151/what-do-numbers-starting-with-0-mean-in-python

    These are numbers represented in base 8 (octal numbers). For example,

    011 is equal to 1*(8**1) + 1*(8**0) = 9,
    0100 is equal to 1*(8**2) + 0*(8**1) + 0*(8**0) = 64,
    027 is equal to 2*(8**1) + 7*(8**0) = 16 + 7 = 23.
    ericbize
        4
    ericbize  
    OP
       Jul 12, 2017 via Android
    @daya0576 明白了,谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1236 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 17:45 · PVG 01:45 · LAX 10:45 · JFK 13:45
    ♥ Do have faith in what you're doing.