to char python code example
Example 1: python string to list of chars
l = list('abcd')
l = map(None, 'abcd')
l = [i for i in 'abcd']
import re
l = re.findall('.', 'abcd')
print(l)
Example 2: python char at
>>> s = "python"
>>> s[3]
'h'
>>> s[6]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> s[0]
'p'
>>> s[-1]
'n'
>>> s[-6]
'p'
>>> s[-7]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>>
Example 3: how to get any letter of a string python
Random = "Whatever"
words2 = Random.split(" ")
print('number of letters:')
print(len(Random))
while True:
ask = int(input("what letter do you want?"))
print(Random[ask-1])