我有一个排除列表:
['topo', 'ecv', 'logs']
我有一个名单:
['topo-116.qq.txt', 'sssecv-controls-11-11.txt']
我想检查所有名称是否有任何排除列表包含在字符串中。
答案 0 :(得分:2)
>>> exc = ['topo', 'ecv', 'logs']
>>> lst = ['topo-116.qq.txt', 'sssecv-controls-11-11.txt']
>>> print filter(lambda i: any([i.startswith(s) for s in exc]), lst)
['topo-116.qq.txt']