Fix excise to have no effect if s doesn't contain split marks.

This commit is contained in:
voussoir 2020-01-30 12:34:03 -08:00
parent 3928922731
commit 4717ccf84e

View file

@ -67,7 +67,9 @@ def excise(s, mark_left, mark_right):
excise('What a wonderful day [soundtrack].mp3', ' [', ']') -> excise('What a wonderful day [soundtrack].mp3', ' [', ']') ->
returns 'What a wonderful day.mp3' returns 'What a wonderful day.mp3'
''' '''
if mark_left in s and mark_right in s:
return s.split(mark_left)[0] + s.split(mark_right)[-1] return s.split(mark_left)[0] + s.split(mark_right)[-1]
return s
def longest_length(li): def longest_length(li):
longest = 0 longest = 0