Though not widely known, str.endswith also accepts a tuple. You don’t need to loop.
>>> 'test.mp3'.endswith(('.mp3', '.avi'))
True
Though not widely known, str.endswith also accepts a tuple. You don’t need to loop.
>>> 'test.mp3'.endswith(('.mp3', '.avi'))
True