I have a list of strings, from which I want to locate every line that has \'http://\' in it, but does not have \'lulz\', \'lmfao\', \'.png\', or any other items in a list of str
Here is an option that is fairly extensible if the list of strings to exclude is large:
exclude = ['lulz', 'lmfao', '.png']
filter_func = lambda s: 'http://' in s and not any(x in s for x in exclude)
matching_lines = filter(filter_func, string_list)
List comprehension alternative:
matching_lines = [line for line in string_list if filter_func(line)]