python字符串不包含起始的任何列表项

python字符串不包含起始的任何列表项,python,Python,我有一个排除列表: ['topo', 'ecv', 'logs'] 我有一张名单: ['topo-116.qq.txt', 'sssecv-controls-11-11.txt'] 我想检查所有名称中是否有任何排除列表从一开始就包含在字符串中。filter_func=lambda rpm:not any(x in rpm代表x in tools)rpm=[rpm for rpm in rpm in rpm if filter_func(rpm)]这将检查整个字符串。也许“topo xxxx

我有一个排除列表:

['topo', 'ecv', 'logs'] 
我有一张名单:

['topo-116.qq.txt', 'sssecv-controls-11-11.txt']

我想检查所有名称中是否有任何排除列表从一开始就包含在字符串中。

filter_func=lambda rpm:not any(x in rpm代表x in tools)rpm=[rpm for rpm in rpm in rpm if filter_func(rpm)]这将检查整个字符串。也许
“topo xxxx”。startswith(“topo”)
会起作用吗?
>>> 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']