I would suggest using the pathlib
module which makes it easy to actually check the file's extension — which is a more rigorous test than merely whether the one string is a substring of another:
from pathlib import Pathfile_paths = ['/Users/me/1. intro.mp4', '/Users/2. intro.vtt', '/Users/1. ppt.rar','/Users/2. ppt.mp4']def filter_on_extension(paths, ext): return [path for path in paths if Path(path).suffix == ext]file_extension = '.mp4'result = filter_on_extension(file_paths, file_extension)print(result) # -> ['/Users/me/1. intro.mp4', '/Users/2. ppt.mp4']