The Python chr() function
Description
chr() takes an integer in the range(256) (that is, 0-255) as a parameter and returns the corresponding character.
Syntax
The syntax of the chr() method is as follows:
chr(i)
Parameters
- i -- a number in either decimal or hexadecimal form.
Return Value
Returns the ASCII character corresponding to the current integer.
Example
The following examples show the use of the chr() method:
chr
(
0
x30
)
,
chr
(
0
x31
)
,
chr
(
0
x61
)
Hexadecimal
0
1
a
chr
(
48
)
,
chr
(
49
)
,
chr
(
97
)
Decimal
0
1
a
Python built-in function