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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With