print a char given by hex

Wolfgang Grafen Wolfgang.Grafen at marconi.com
Tue Oct 17 18:32:44 CEST 2000


Klaus Bruns wrote:
> 
> Hi there,
> 
> I have a problem with printing character given by hexadecimal. My string
> looks like this "\\x54" but what I want to have is "\x54" for printing
> the character 'T' and not '\x54'.
> Can someone help me please, for creating a string from "\\x54" to
> "\x54"?
> 
> Thank you!
> 
> Klaus

>>> chr(eval('0%s'%'\\x54'[1:]))
'T'



More information about the Python-list mailing list