Home >Backend Development >Python Tutorial >How to convert letters to numbers in python
How to convert letters into numbers in python?
Convert English letters into numbers:
Conversion
ord('F')
Related recommendations: "Python Tutorial"
Reverse
chr(70)
python ord() function
is the paired function of the chr() function (for 8-bit ASCII strings) or unichr() function (for Unicode objects), It takes a character (a string of length 1) as a parameter and returns the corresponding ASCII value or Unicode value. If the given Unicode character exceeds your Python definition range, a TypeError exception will be raised.
The following is the syntax of the ord() method:
ord(c)
Parameters
c -- Characters.
Return value
The return value is the corresponding decimal integer.
The above is the detailed content of How to convert letters to numbers in python. For more information, please follow other related articles on the PHP Chinese website!