How do I split a sentence by a step value in python ? I can use split()
to SPLIT the sentence by a separator like this:
str.split("\n")
For example:
I have a sentence: "The quick brown fox jumps over the lazy dog"
I want to split it by 3 words : ['The quick brown','fox jumps over', 'the lazy dog']
How do i do that with or without a function?
I tried split()
but it returns a list where each word is a item.
['The' ,'quick' ,'brown','fox' ,'jumps' ,'over', 'the' ,'lazy','dog']