> Does anybody know how to convert a HEX into a BINARY?

The easiest way I know is to use a lookup table on 
the octal representation.

def bin(n):
   bins = ['000','001','010,'011',....'111']
   result = ''   
   for c in oct(n):
     result += bins[int(c,8)]
   return result

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld
      

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to