Why Python don't accept 03 as a number?

Serhiy Storchaka storchaka at gmail.com
Sat Dec 8 01:59:01 EST 2018


08.12.18 03:17, jfong at ms4.hinet.net пише:
>>>> 00
> 0
>>>> 03
>    File "<stdin>", line 1
>      03
>       ^
> SyntaxError: invalid token


In Python 3.8 the error message will be more informative:

>>> 03
   File "<stdin>", line 1
SyntaxError: leading zeros in decimal integer literals are not 
permitted; use an 0o prefix for octal integers



More information about the Python-list mailing list