Given text I want to find words occurring before unknown
import re
text="the women marathon unknown introduced at the summer olympics los angeles usa and unknown won"
items=re.finditer('unknown',text). #as there are 2 unknown
for i in items:
print(i.start()) #to get index of 2 unknown
output is
19
81
Now how to extract words occuring before the two unknowns separately?
For 1st unknown I should get the,women.
and for the second unknown I should get usa,and