[Tutor] built-in hex->int question
Lloyd Hugh Allen
lha2@columbia.edu
Mon, 07 Jan 2002 18:29:32 -0500
You can do long(float('0xaf')), if you want to...don't know if that
helps.
Huuuuuu wrote:
>
> Hi Tutor,
>
> Why understands the float() function a string argument but not
> integer-cast-functions?
>
> >>> int('0xaf')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ValueError: invalid literal for int(): 0xaf
> >>> long('0xaf')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ValueError: invalid literal for long(): 0xaf
> >>> float('0xaf')
> 175.0
>
> Thanks,
> willi
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor