0

my code:

entered_text = input(str("Enter text - \n"))

entered_text = list(entered_text.split('. ' and ', ' and ' ' and '.'))

print(entered_text)

but I receive this as a result. ['text1 text2 text3 text4'] as one element, how i can devide them?

  • 1
    Does this answer your question? [How to split a string into a list?](https://stackoverflow.com/questions/743806/how-to-split-a-string-into-a-list) – Martin Böschen Dec 06 '20 at 18:17
  • You are asking about python's split function (https://docs.python.org/3.3/library/stdtypes.html?highlight=split#str) . With no arguments, it will split on the blanks, i.e. making words from a sentence. Your question has already been asked: https://stackoverflow.com/questions/743806/how-to-split-a-string-into-a-list – Martin Böschen Dec 06 '20 at 18:19

1 Answers1

0

I did it like this:

entered_text = input(str("Enter text = \n"))

res = entered_text.strip().split(" ")