Re: [Tutor] Re: how to separate hexadecimal

2005-02-02 Thread Alan Gauld
> >>> hexa = '0x87BE' > >>> upper = int(hexa[2:4], 16) > >>> lower = int(hexa[4:6], 16) FWIW : You don't need to strip the '0x' from the front, int() is smart enough to do that automatically for base 16 conversions... Alan G. ___ Tutor maillist -

[Tutor] Re: how to separate hexadecimal

2005-02-02 Thread Wolfram Kraus
jrlen balane wrote: i have a 4 digit hex number (2 bytes) and i want to separate it into 2 digit hex (1 byte each) meaning i want to get the upper byte and the lower byte since i am going to add this two. how am i going to do this? should i treat it just like a normal string? please help, thanks. e