I want to check if some line ends with any substring defined in some list. Is there a better way than following one?
endsA = ['foo', 'bar', 'fur', 'beer']
endsB = ['door', ... ]
def checkEnds(line, ends):
for end in ends:
if line.endsWihtendswith(end):
return True
....
if checkEnds(line, endsA):
do_something()