Home  >  Article  >  Backend Development  >  python function chr(i)

python function chr(i)

巴扎黑
巴扎黑Original
2017-08-21 13:43:403521browse

chr(i)

Chinese description:

Returns the ASCII character corresponding to the integer i. The opposite effect of ord().

Parameter x: a positive number in the value range [0, 255].

Version: This function is available in all versions of python2 and python3. There are no compatibility issues.

English description:

Return a string of one character whose ASCII code is the integer i. For example, chr(97) returns the string 'a'. This is the inverse of ord(). The argument must be in the range [0..255], inclusive; ValueError will be raised if i is outside that range. See also unichr().

Code example:

>>> chr(97)
'a'
>>> chr(98)
'b'
>>> ord('a')
97
>>> ord('b')
98

ps: Haha, the usage of this function is the same as that in php

The above is the detailed content of python function chr(i). 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