NEWBIE: 'print 0108' is syntax error?

Derrick 'dman' Hudson dman at dman13.dyndns.org
Thu Oct 30 17:30:01 EST 2003


Michael Iles <mikei at kinitos.com> wrote:

> Please forgive me for posting such an inane question, I just want to
> know what's going on here:
> 
> -----------------------------------------------------------
> Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information. 
>>>> print 0105
           ^
Octal (base 8) number.

> 69
Decimal (base 10) equivalent

>>>> print 0106
> 70

again

>>>> print 0107
> 71

again

>>>> print 0108
>  File "<stdin>", line 1
>    print 0108
>             ^
> SyntaxError: invalid token

8 is not a valid octal digit.

>>>> print 0109
>  File "<stdin>", line 1
>    print 0109
>             ^
> SyntaxError: invalid token

again, 9 is not a valid octal digit

>>>> print 0110
> 72

This is the next number, in octal representation.

>>>> print 0111
> 73

Again.

> -----------------------------------------------------------
> 
> What's up with octal 108 and octal 109?

They don't exist.

-D

-- 
If you want to know what God thinks about money,
just look at the people He gives it to.
    -- Old Irish Saying
 
www: http://dman13.dyndns.org/~dman/             jabber: dman at dman13.dyndns.org




More information about the Python-list mailing list