Find and Conditional Expressions solution in Clear category for Between Markers by smidem
def between_markers(text: str, begin: str, end: str) -> str:
# Find the index at the end of begin if it's present.
begin = text.find(begin) + len(begin) if begin in text else 0
# Find the index of end if it's present.
end = text.find(end) if end in text else len(text)
Sept. 25, 2018