How do I split a sentence and store each word in a list? e.g.
"these are words" ⟶ ["these", "are", "words"]
To split on other delimiters, see Split a string by a delimiter in python.
To split into individual characters, see How do I split a string into a list of characters?.
Given a string sentence
, this stores each word in a list called words
:
words = sentence.split()