def between_markers(text: str, begin: str, end: str) -> str:
word = ''
if text.find(begin) and text.find(end) > 0:
for i in text[text.find(begin) + len(begin):text.find(end):]:
word += i
return word
elif text.find(begin) != -1 and text.find(end) == -1:
for i in text[text.find(begin) + len(begin):text[-1]:]:
word += i
return word
elif text.find(begin) == -1 and text.find(end) != -1:
for i in text[:text.find(end):]:
word += i
return word
elif text.find(begin) > text.find(end):
return word
else:
return text
I really can not understand why my code is not working in "No[/b] hi"
It returns me nothing (empty string - '')
I can understand why, because i wrote third elif special for this cases~
Created at: 2020/02/29 14:07; Updated at: 2020/03/01 08:56