The function ord() gets the int value of the char. And in case you want to convert back after playing with the number, function chr() does the trick as shown in the below example –
1 2 3 |
print(ord('a')) ## Returns 97 print(chr(97)) ## Returns a |