The chr() function in python takes as a parameter an integer and outputs the corresponding Unicode character
chr(i) #where i is an integer in the range 0 to 1,114,111
The chr() function only takes an integer number as a parameter and returns the corresponding character
Parameter | Description | Required / Optional |
---|---|---|
An integer | The integer must be in the range of 0 to 1,114,111 |
Required |
The return value is always a Unicode string
Input | Return Value |
---|---|
Integer | Returns a Unicode character |
print(chr(64))
print(chr(65))
print(chr(100))
Output:
@ A d
print(chr(-1))
print(chr(1114112))
Output:
ValueError: chr() arg not in range(0x110000) ValueError: chr() arg not in range(0x110000)