Python endswith() with multiple string
endswith() accepts a tuple of suffixes. You can either convert your list to a tuple or just use a tuple in the first place instead of list. In [1]: sample_str = “Chicago Blackhawks vs. New York Rangers” In [2]: suffixes = (“Toronto Maple Leafs”, “New York Rangers”) In [3]: sample_str.endswith(suffixes) Out[3]: True From doc: str.endswith(suffix[, …