Home >Backend Development >Python Tutorial >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!