Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
try text.index() solution in Clear category for Between Markers by martin.pilka
def between_markers(text: str, begin: str, end: str) -> str:
# Find i_begin
try:
i_begin = text.index(begin) + len(begin)
except ValueError:
i_begin = None
# Find i_end
try:
i_end = text.index(end)
except ValueError:
i_end = None
# Return value between markers
return text[i_begin:i_end]
Dec. 26, 2018
Comments: