How can I convert a character to a integer in Python, and viceversa? September 22, 2022 by Tarik Use chr() and ord(): >>> chr(97) 'a' >>> ord('a') 97