如何将所有标准设置为一个列表并在字符串中搜索?
name = [s for s in files if (("реес") in s.lower() or ("m&s") in s.lower() )and
("элект") not in s.lower() and
("сво") not in s.lower() and
("кхп") not in s.lower() and
("rar") not in s.lower() and
("пор") not in s.lower() and
("инф") not in s.lower() and
("бум") not in s.lower() and
("доп") not in s.lower() and
("msg") not in s.lower() and
("сро") not in s.lower() and
("ank") not in s.lower()]
答案 0 :(得分:3)
您可以使用嵌套条件。
[s for s in files if all(val not in s.lower() for val in ('abc', 'def', 'ghi'))]