I have a list of strings and i want to remove the strings having the strings in the list excludeList in them. Filter takes a function and a list, how can i “functionify” excluded not in? excludeList looks something like: ["A2123", "B323", "C22"]
and the kolaDataList looks like: ["Very long string somethingsomething B323", "Lorem ipsum"]
and the result should be [Lorem ipsum]
for excluded in excludeList:
kolaDataList = filter((excluded not in), kolaDataList)
I suppose this would work in haskell but how do I do this in python?
You can use a lambda, or anonymous function:
Alternatively, just use a list comprehension: