This is because your listeexclure
is just a string. If you want to search a string
in another string
, you can do following:
Let’s assume you have a list
like:
lst = ['a', 'ab', 'abc', 'bac']
filter(lambda k: 'ab' in k, lst)
# Result will be ['ab', 'abc']
So you can apply same method in your code, I think. So in your case:
filter((lambda k: broadcastMSA in k, listeexclure)
I hope it will help
2
solved Filter words from list python