Home >Backend Development >Python Tutorial >How to convert letters to numbers in python

How to convert letters to numbers in python

藏色散人
藏色散人Original
2019-09-28 17:26:1414483browse

How to convert letters to numbers in python

How to convert letters into numbers in python?

Convert English letters into numbers:

Conversion

ord('F')

How to convert letters to numbers in python

Related recommendations: "Python Tutorial"

Reverse

chr(70)

How to convert letters to numbers in python

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Is python free software?Next article:Is python free software?

Related articles

See more