concept chr() in category python

appears as: chr()
Tiny Python Projects: Learn coding and testing with puzzles and games

This is an excerpt from Manning's book Tiny Python Projects: Learn coding and testing with puzzles and games.

You can go back and forth between characters and their ordinal values by using the chr() and ord() functions. We will explore and use these functions later in chapter 18. Here are the ord() values for the vowels:

>>> for char in 'aeiou':
...     print(char, ord(char))
...
a 97
e 101
i 105
o 111
u 117

You can create the same output by starting with the ord() values to get the chr() values:

  • Learn about the ord() and chr() functions