+ 2
How can i split a string?
Like "{precious}" to "{p r e c i o u s}" something like that
3 Respuestas
+ 3
str='precious'
lst=list(str)
print(*lst)
or
print(*[i for i in 'precious'])
+ 3
#To split a sentence into a list of words
sentence='To split a sentence into a list of words.'
sentence_list=sentence.split()
print(sentence_list,'\n')
#To split the words in the sentence into lists
word_list_in_Sentence_list=[list(word) for word in sentence_list]
print(word_list_in_Sentence_list,'\n')
[print(' '.join(word),end=' ') for word in sentence_list]
+ 1
x = input()
for each in x:
print(each, end=' ')