Source text: United States Declaration of Independence
How can one split the above source text into a number of sub-strings, containing an ‘n’ number of words?
I use split(‘ ‘) to extract each word, however I do not know how to do this with multiple words in one operation.
I could run through the list of words that I have, and create another by gluing together words in the first list (whilst adding spaces). However my method isn’t very pythonic.
prints:
or, as a list comprehension: