Error evaluating numbers starting in zero

entropia entropiamax at jazzfree.com
Mon Dec 18 12:09:52 CET 2000


The numbers starting with 0 are octal (and with 0x hexadecimal).
08 doesn't exist in octal and this is a error.
8 is 010 in octal:
>>010
8


Mike Brenner escribió:

> >> I have a python checkbook program that evaluates date strings, such
> >> as "01/31/99". Most dates are fine, but if I have a date such as
> >> "01/08/99", python runs into an error when it tries to eval("08").
>
> > Use int() instead of eval().
>
> So, that may also explain the failure with
>
>         i = 08
>
> and with reading in numbers,
> the python interpretor must be using EVAL instead of INT?
>
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list