0

Python - String to Char type-conversion?

how do I use type-conversion to return a type chart from a string which contains only a single letter? i.e. for word in sentence: for letter in word: someFunctionWillNeedChar=(char)letter???? ...or =char(letter)????? help?

27th Aug 2018, 5:54 PM
Jacob Turet
Jacob Turet - avatar
5 Answers
+ 1
python does not have a char datatype.. just append each letter to a list. chars=[] for i in "Help": chars.append(i) print(chars[2])
27th Aug 2018, 6:40 PM
LordHill
LordHill - avatar
+ 1
ohhhh, I'm an idiot...anyways. nvmd, thanks!
27th Aug 2018, 6:41 PM
Jacob Turet
Jacob Turet - avatar
+ 1
no i m a idiot
29th Aug 2018, 2:02 PM
Rodrigo Bomfim
Rodrigo Bomfim - avatar
0
for i in "Help": print(i) If you iterate thru the word, it will give you letter by letter
27th Aug 2018, 6:14 PM
LordHill
LordHill - avatar
0
that's not the problem I'm having. as you can see in the OP here, for letter in word: instead of printing letter, I want to save letter to a separate variable, and typecast it as type char.
27th Aug 2018, 6:37 PM
Jacob Turet
Jacob Turet - avatar