Error evaluating numbers starting in zero

entropia entropiamax at jazzfree.com
Mon Dec 18 09:20:35 CET 2000


Python, like most languages interpret a number starting with 0 as a octal
(and 0x as a hexadecimal). 08 doesn't exists in octal (8=010 in octal).
Because this you should use int("08") and not eval("") OR
 eval("010")-->8
 int("08")-->8


Janko Hauser escribió:

> "Richard P. Muller" <rpm at wag.caltech.edu> writes:
>
> > "01/08/99", python runs into an error when it tries to eval("08").
> >
> The use of int("08") may help
>
> HTH,
> __Janko
>
> --
>   Institut fuer Meereskunde             phone: 49-431-597 3989
>   Dept. Theoretical Oceanography        fax  : 49-431-565876
>   Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
>   24105 Kiel, Germany
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list