[Tutor] Hex to Str - still an open issue

Kent Johnson kent37 at tds.net
Fri Feb 4 14:50:42 CET 2005


You might be interested in these:
http://groups-beta.google.com/group/comp.lang.python/msg/c2cb941ea70dcdad
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286

Kent

Tamm, Heiko wrote:
> Thank you, Pierre,
> 
> But I'm looking for a solution to convert a Hex number into binary, decimal, interger numbers.
> 
> E.g.:
> 
> What is the the binary value of the hex number 1F4.
> 
> Is there a function available, or how can it be done?
> 
> 
> 
> Kind regards and a nice weekend
> 
>   Heiko
> 
>  
> 
> -----Original Message-----
> From: Pierre Barbier de Reuille [mailto:pierre.barbier at cirad.fr] 
> Sent: Friday, February 04, 2005 2:35 PM
> To: Tamm, Heiko
> Cc: tutor at python.org
> Subject: Re: [Tutor] Hex to Str
> 
> Given you have a number in 'a' :
> 
> hex(a)
> 
> returns the hexadecimal representation of 'a' as a string !
> You can also try :
> 
> "%x" % a
> 
> After that, I don't know if there is some builtin to print a number in any base you want !
> 
> Pierre
> 
> Tamm, Heiko a écrit :
> 
>>Hello,
>> 
>>I like to know, if it's possible to convert a Hex number into String 
>>or other formats?
>> 
>>How can it be done?
>> 
>> 
>>Kind regards
>> 
>>  Heiko
>>
>>
>>
>>----------------------------------------------------------------------
>>--
>>
>>_______________________________________________
>>Tutor maillist  -  Tutor at python.org
>>http://mail.python.org/mailman/listinfo/tutor
> 
> 
> --
> Pierre Barbier de Reuille
> 
> INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP Botanique et Bio-informatique de l'Architecture des Plantes TA40/PSII, Boulevard de la Lironde
> 34398 MONTPELLIER CEDEX 5, France
> 
> tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list