Equivalent to chr(eval(self.myhex)) without using eval?
Chad Netzer
cnetzer at mail.arc.nasa.gov
Wed Dec 18 15:25:16 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.
myhex = '0x100'
chr( int( myhex, 16 ) ) == 'd'
ie. use int() to convert the hex string to decimal, then use chr()
--
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