TTF = ('abc.com/648','xxx.com/246','def.com/566','ghi.com/624','xxx.com/123')filtered = tuple(filter(lambda e: "xxx" not in e, TTF))print(filtered)类似于Green Cloak Guy,但filter改为使用。
简单的过滤列表理解。字符串支持用于子字符串匹配,因此您可以通过执行in来检查字符串是否包含.xxxxxx in string结果:TTF_without_xxx = tuple(s for s in TTF if 'xxx' not in s)# ('abc.com/648', 'def.com/566', 'ghi.com/624')