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?
5 Respuestas
+ 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])
+ 1
ohhhh, I'm an idiot...anyways. nvmd, thanks!
+ 1
no i m a idiot
0
for i in "Help":
print(i)
If you iterate thru the word, it will give you letter by letter
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.