+ 1
Split line of text into words per line
how to write code using python3 that will input a line of text, split it into words, and display these words one per line.
3 Réponses
+ 1
phrase = input('enter a phrase')
phrase = phrase.split(' ')
for x in phrase:
print(phrase[x])
print('\n')
0
Take a look at the python3 docs for the input function and the split method both can help you out with this and for more advanced techniques take a look at the re module.