What do numbers starting with 0 mean in python?

后端 未结 9 2083
忘掉有多难
忘掉有多难 2020-11-22 05:34

When I type small integers with a 0 in front into python, they give weird results. Why is this?

>>> 011
9
>>> 0100
64
>>> 027
23
<         


        
9条回答
  •  粉色の甜心
    2020-11-22 05:44

    Numbers in Octal numerical system. Other prefixes are 0x for hexadecimal and 0b for binary.

提交回复
热议问题