Home > Backend Development > Python Tutorial > python function chr(i)

python function chr(i)

巴扎黑
Release: 2017-08-21 13:43:40
Original
3601 people have browsed it

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
Copy after login

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!

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