Re: how to convert ‘\xf0' to 0xf0 ?

chengang.beijing at chengang.beijing at
Fri Dec 12 05:23:23 CET 2008

'\xf0' is the value read from a binary file, I need to change this
kinds strings to int for further processing...
if it is in C, then '\xf0' is an integer and it can be handled
directly, but in python, it is a string.

and both int('10',16) and int('0x10',16) returns 16.

Br, Chen Gang

On Dec 12, 12:06 pm, Tommy Nordgren <tommy.nordg... at> wrote:
> On Dec 12, 2008, at 4:48 AM, chengang.beij... at wrote:
> > int('\xf0',16) doesn't work, any way to do that?
> > --
> >
>         Should be int('10',16)
> or int('0x10',16)
> ------------------------------------------------------
> "Home is not where you are born, but where your heart finds peace" -
> Tommy Nordgren, "The dying old crone"
> tommy.nordg... at

More information about the Python-list mailing list