Equivalent to chr(eval(self.myhex)) without using eval?

Chad Netzer cnetzer at mail.arc.nasa.gov
Wed Dec 18 15:27:55 EST 2002


On Wednesday 18 December 2002 12:06, Jeff Kowalczyk wrote:
> I have a class instance attribute which is a string
> representation of a hex value. I need to get the chr() character
> back.

My last example should have been:

myhex = '0x64'
chr( int( myhex, 16 ) ) == 'd'

where 0x64 == 100 decimal

-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list