How Can I Convert a Character to a Integer in Python, and Viceversa?
I Want to Get, Given a Character, Its Ascii Value. for Example, for the Character A, I Want to Get 97, and Vice Versa. 4 Answers Use Chr() and Ord(): >>>...
I want to get, given a character, its ASCII value.
For example, for the character a, I want to get 97, and vice versa.
>>> ord('a')
97
>>> chr(97)
'a'
ord and chr
For long string you could use this.
''.join(map(str, map(ord, 'pantente')))