[Tutor] how to separate hexadecimal

jrlen balane nbbalane at gmail.com
Wed Feb 2 08:10:36 CET 2005

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"  # what i want to do is:
      a = 0x87, b = 0xBE    # so that i could do this:
      c = a + b            #which should be equal to 0x145

More information about the Tutor mailing list