Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
try and except solution in Clear category for Between Markers by jakub.bortlik
def between_markers(text: str, begin: str, end: str) -> str:
"""
returns substring between two given markers
"""
try:
begin = text.index(begin) + len(begin)
except ValueError:
begin = 0
try:
end = text.index(end)
except ValueError:
end = len(text)
return text[begin:end]
April 5, 2020