Starting a number with a zero marks it as octal in Python 2. This has been recognized as confusing, surprising and also inconsistent, as starting with 0x will mark it as hexadecimal. Therefore, in Python 3, starting with 0 is invalid, and you get octal by starting with 0o. You can also start with 0b to mark it as binary.
>>> 10
10
>>> 0x10
16
>>> 0o10
8
>>> 0b10
2
>>> 010
File "<stdin>", line 1
010
^
SyntaxError: invalid token
0x, 0o and 0b also works in Python 2.6 and Python 2.7.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…