Home  >  Article  >  Backend Development  >  What does chr mean in python?

What does chr mean in python?

藏色散人
藏色散人Original
2019-06-22 13:28:3538040browse

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)

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

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!

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