Home > Backend Development > Python Tutorial > What does chr mean in python?

What does chr mean in python?

藏色散人
Release: 2019-06-22 13:28:35
Original
38084 people have browsed it

What does chr mean in python?

python chr() uses an integer in the range (256) (that is, 0 to 255) as a parameter and returns a corresponding character.

The following is the syntax of the chr() method:

chr(i)
Copy after login

Parameters

i -- It can be decimal or hexadecimal form of numbers.

Return value

The return value is the ASCII character corresponding to the current integer.

The following shows an example of using the chr() method:

>>>print chr(0x30), chr(0x31), chr(0x61)   # 十六进制
0 1 a
>>> print chr(48), chr(49), chr(97)         # 十进制
0 1 a
Copy after login

Related recommendations: "Python Tutorial"

The above is the detailed content of What does chr mean 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