Convert string to ASCII Value Python

In this Python string tutorial, you will learn how to convert string to ASCII value in Python.

# Create a string
S = "AiHints"

# Convert string into ascii
A = [ord(c) for c in S]

# Print ascii
print(A)

Output:

[65, 105, 72, 105, 110, 116, 115]

Free learning resources: AiHintsCodeAllow

Leave a Comment

Your email address will not be published.