[Tutor] Hex to Str

Ewald Ertl ewald.ertl at hartter.com
Fri Feb 4 14:37:37 CET 2005


Hello Heiko, 

I do not really know what you like to get, but the hex-number's in Python are usedd
in a numeric representation. As far as I have seen in the interpreter, this depends 
on the value:

>>> a=0xaaaaabbbbbccccccddddddd
>>> type(a)
<type 'long'>

>>> a=0xaabb
>>> type(a)
<type 'int'>

If you like to see the number as a hex-String you can use 
>>> hex(a)
'0xaabb'
the representation as an octal number
>>> oct(a)
'0125273'

HTH Ewald 

on Fri, 4 Feb 2005 14:18:28 +0100  "Tamm, Heiko" <h-tamm at ti.com> wrote :
---------------------------------------------------------------------------------------------

Tamm, Heiko > Hello,
Tamm, Heiko >  
Tamm, Heiko > I like to know, if it's possible to convert a Hex number into String or
Tamm, Heiko > other formats?
Tamm, Heiko >  
Tamm, Heiko > How can it be done?
Tamm, Heiko >  
Tamm, Heiko >  
Tamm, Heiko > Kind regards
Tamm, Heiko >  
Tamm, Heiko >   Heiko


------------------- end ----------------------



More information about the Tutor mailing list