[Tutor] How to convert hex representation of char? (Challenge part 8)

Pieter Lust pieter.lust at katho.be
Wed May 18 22:29:58 CEST 2005


Alan G wrote:
 > '\x14' is the actual non printable charactewrs. If it were printable
 > you
 > would see its printed representation, because it isn't Pyhon showsw
 > you
 > the hex code as an escaped character but it is the character.
 >

Thanks for the input. I'm sorry, my question was not clear enough.

The problem is that (to stick with the example) '\x14' is not the 
character 0x14, but a string of length 4. It consists of the characters 
backslash, 'x', '1' and '4'. (I verified the output of len()).
What I want to do is make Python believe that that string of length 4 is 
actually a string of length 1 that contains character 0x14. Any help on 
how to achieve that is appreciated.


Pieter Lust



More information about the Tutor mailing list