Question

I want to get, given a character, its ASCII value.

For example, for the character a, I want to get 97, and vice versa.

Was it helpful?

Solution

Use chr() and ord():

>>> chr(97)
'a'
>>> ord('a')
97

OTHER TIPS

>>> ord('a')
97
>>> chr(97)
'a'

ord and chr

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top