maping two-digit integers to a single ascii character, inverse of ord()?

Sean 'Shaleh' Perry shalehperry at attbi.com
Thu Aug 22 20:20:22 CEST 2002


On Thursday 22 August 2002 11:16 am, Jeff Kowalczyk wrote:
> I have a device that stores ascii characters. I need to normalize the
> storage of integers from 0 to about 45 or so as a single character.
>
> What is the most efficient way to map integers of one and two digits into a
> single ascii  (any of 128 chars) alphanumeric character digit?
>
> Is there an inverse function of ord()?
>
> Thanks.

chr() is the inverse of ord()

>>> chr(ord('A'))
'A'




More information about the Python-list mailing list