Hi I need to be able to convert a ascii character into its decimal equivalent and vice-versa.
How can I do that?
Hi I need to be able to convert a ascii character into its decimal equivalent and vice-versa.
How can I do that?
num=ord(char)
char=chr(num)
For example,
>>> ord('a')
97
>>> chr(98)
'b'
You can read more about the built-in functions in Python here.
Use ord
to convert a character into an integer, and chr
for vice-versa.
ord