Re: [Tutor] how to separate hexadecimal

2005-02-02 Thread Max Noel
On Feb 2, 2005, at 10:19, Ewald Ertl wrote: Hi! Using binary operations: a='0x87BE' str(hex(int(a,16) & 0xFF)) '0xbe' str(hex((int(a,16) & 0xFF00) / 0xFF)) '0x87' HTH Ewald Actually, the int conversions aren't even necessary. >>> hex(0x87BE & 0xFF) '0xbe' >>> hex((0x87BE & 0xFF00) / 0xFF) '0x8

Re: [Tutor] how to separate hexadecimal

2005-02-02 Thread Ewald Ertl
Hi! Using binary operations: >>> a='0x87BE' >>> str(hex(int(a,16) & 0xFF)) '0xbe' >>> str(hex((int(a,16) & 0xFF00) / 0xFF)) '0x87' >>> HTH Ewald on Wed, 2 Feb 2005 15:10:36 +0800 jrlen balane <[EMAIL PROTECTED]> wrote : ---

[Tutor] how to separate hexadecimal

2005-02-01 Thread jrlen balane
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. ex. hexa = '0x87BE"