Look how easy it is using BeautifulSoup
:
from bs4 import BeautifulSoup
data = """Yesterday<person>Peter Smith</person>drove to<location>New York</location>"""
soup = BeautifulSoup(data, 'html.parser')
for item in soup:
print item
prints:
Yesterday
<person>Peter Smith</person>
drove to
<location>New York</location>
UPD (splitting non-tag items into spaces and print every part on a new line):
soup = BeautifulSoup(data, 'html.parser')
for item in soup:
if not isinstance(item, Tag):
for part in item.split():
print part
else:
print item
prints:
Yesterday
<person>Peter Smith</person>
drove
to
<location>New York</location>
Hope that helps.