Use the hex() function to convert an integer to a hex string representation:
 >>> hex(54)
'0x36'
 >>> hex(0x54)
'0x54'

or for more control use %x string formatting:
 >>> '%x' % 54
'36'
 >>> '%04X' % 0xab
'00AB'

etc.

Kent

Tamm, Heiko wrote:
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@python.org
http://mail.python.org/mailman/listinfo/tutor

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

Reply via email to