Python - filling gaps in a string from another string

Viewed 37
s1 = "dogs really hate cats and cats hate dogs and rabbits hate foxes and foxes dont hate rabbits"
s2 = "? ? hate ?"

now, I somehow want to create a list, that will look like this:

[
     "dogs really hate cats",
     "foxes dont hate rabbits"
]

Note, that "cats hate dogs" and "rabbits hate foxes" are not in the list, since there's only one word before "hate", but there are two question marks in the s2-String

0 Answers
Related