Convert string to ASCII value python

You can use a list comprehension:

>>> s = 'hi'
>>> [ord(c) for c in s]
[104, 105]

Leave a Comment