chr(i)
Return the string representing a character whose Unicode code point is the integer i. For example, chr(97) returns the string ‘a’, while chr(8364) returns the string ‘€’. This is the inverse of ord().
The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in base 16). ValueError will be raised if i is outside that range.
In [
4]: chr(
14)
Out[
4]:
'\x0e'
In [
5]: chr(
44)
Out[
5]:
','
In [
6]: chr(
60)
Out[
6]:
'<'
ord(c)
Given a string representing one Unicode character, return an integer representing the Unicode code point of that character. For example, ord(‘a’) returns the integer 97 and ord(‘€’) (Euro sign) returns 8364. This is the inverse of chr().
In [
7]: ord(
'a')
Out[
7]:
97
In [
8]: chr(
97)
Out[
8]:
'a'