I have created a list that contains a different paragraph inside each element.
I want to find the first word of each paragraph.
The only thing I can come up with is to split each paragraph in to individual words and find element[0]. This seems fairly excessive as I already have each paragraph already in the list
So what is a better way to do this?
Something like this?
prints: [‘start’, ‘start’, ‘para’]
If you don’t want to split each paragraph, you could search for the index of the first space, and grab each word up to that:
prints: [‘start’, ‘start’, ‘para’]
Explanation as requested:
pin turn