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!