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

How to convert letters to numbers in python

藏色散人
Release: 2019-10-01 17:07:01
Original
14485 people have browsed it

How to convert letters to numbers in python

How to convert letters into numbers in python?

Convert English letters into numbers:

Conversion

ord('F')
Copy after login

How to convert letters to numbers in python

Related recommendations: "Python Tutorial"

Reverse

chr(70)
Copy after login

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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template