>>> s = 'hi'
>>> [ord(c) for c in s]
[104, 105]
asciiValue=ord(stringCharacter)
#example
asciiValue=ord('A')
#in this example asciiValue equals 64
>>> chr(104)
'h'
>>> chr(97)
'a'
>>> chr(94)
'^'
>>> ord('h')
104
>>> ord('a')
97
>>> ord('^')
94
# Python3 code to demonstrate working of
# Convert String list to ascii values
# using loop + ord()
# initialize list
test_list = ['gfg', 'is', 'best']
# printing original list
print("The original list : " + str(test_list))
# Convert String list to ascii values
# using loop + ord()
res = []
for ele in test_list:
res.extend(ord(num) for num in ele)
# printing result
print("The ascii list is : " + str(res))
#python 3.x text = input("enter a string to convert into ascii values:") ascii_values = [] for character in text: ascii_values.append(ord(character)) print(ascii_values)