Re: Reading hex to int from a binary string

2009-10-09 Thread Jack Norton
Luc wrote: Hi all, I read data from a binary stream, so I get hex values as characters (in a string) with escaped x, like "\x05\x88", instead of 0x05. I am looking for a clean way to add these two values and turn them into an integer, knowing that calling int() with base 16 throws an invalid li

Re: Reading hex to int from a binary string

2009-10-09 Thread Diez B. Roggisch
Luc schrieb: On Oct 9, 10:45 am, "Diez B. Roggisch" wrote: Luc schrieb: On Oct 8, 11:13 pm, "Diez B. Roggisch" wrote: Luc schrieb: Hi all, I read data from a binary stream, so I get hex values as characters (in a string) with escaped x, like "\x05\x88", instead of 0x05. I am looking for

Re: Reading hex to int from a binary string

2009-10-09 Thread Luc
On Oct 9, 10:45 am, "Diez B. Roggisch" wrote: > Luc schrieb: > > > > > On Oct 8, 11:13 pm, "Diez B. Roggisch" wrote: > >> Luc schrieb: > > >>> Hi all, > >>> I read data from a binary stream, so I get hex values as characters > >>> (in a string) with escaped x, like "\x05\x88", instead of 0x05. >

Re: Reading hex to int from a binary string

2009-10-09 Thread Diez B. Roggisch
Luc schrieb: On Oct 8, 11:13 pm, "Diez B. Roggisch" wrote: Luc schrieb: Hi all, I read data from a binary stream, so I get hex values as characters (in a string) with escaped x, like "\x05\x88", instead of 0x05. I am looking for a clean way to add these two values and turn them into an intege

Reading hex to int from a binary string

2009-10-09 Thread Luc
Hi all, I read data from a binary stream, so I get hex values as characters (in a string) with escaped x, like "\x05\x88", instead of 0x05. I am looking for a clean way to add these two values and turn them into an integer, knowing that calling int() with base 16 throws an invalid literal excepti

Re: Reading hex to int from a binary string

2009-10-09 Thread Luc
On Oct 9, 3:12 am, Dennis Lee Bieber wrote: > On Thu, 8 Oct 2009 14:52:33 -0700 (PDT), Luc > declaimed the following in gmane.comp.python.general: > > > > > On Oct 8, 11:13 pm, "Diez B. Roggisch" wrote: > > > Luc schrieb: > > > > > Hi all, > > > > > I read data from a binary stream, so I get hex

Re: Reading hex to int from a binary string

2009-10-08 Thread Luc
On Oct 8, 11:13 pm, "Diez B. Roggisch" wrote: > Luc schrieb: > > > Hi all, > > > I read data from a binary stream, so I get hex values as characters > > (in a string) with escaped x, like "\x05\x88", instead of 0x05. > > > I am looking for a clean way to add these two values and turn them > > into

Re: Reading hex to int from a binary string

2009-10-08 Thread Diez B. Roggisch
Luc schrieb: Hi all, I read data from a binary stream, so I get hex values as characters (in a string) with escaped x, like "\x05\x88", instead of 0x05. I am looking for a clean way to add these two values and turn them into an integer, knowing that calling int() with base 16 throws an invalid