Computer >> Computer tutorials >  >> Programming >> Python

How to convert a single character to its integer value in Python?


Each character is associated with an ASCII value which is a unique number. It is obtained by ord() function.

>>> ord('A')
65
>>> ord('+')
43
>>> ord(' ')