eval('000052') = 42?

Bart Ogryczak B.Ogryczak at gmail.com
Wed Feb 21 06:20:37 EST 2007


On Feb 21, 5:09 am, Astan Chee <s... at al.com.au> wrote:
> Hi,
> I just tried to do
> eval('00052') and it returned 42.
> Is this a known bug in the eval function? Or have I missed the way eval
> function works?

It works just fine. Read up on integer literals.

>>> 52   #decimal
52
>>> 052  #octal
42
>>> 0x52 #hexadecimal
82





More information about the Python-list mailing list