列表理解将起作用。
a = [('when', 3), ('why', 4), ('throw', 9), ('send', 15), ('you', 1)]b = ['the', 'when', 'send', 'we', 'us']filtered = [i for i in a if not i[0] in b]>>>print(filtered)[('why', 4), ('throw', 9), ('you', 1)]
列表理解将起作用。
a = [('when', 3), ('why', 4), ('throw', 9), ('send', 15), ('you', 1)]b = ['the', 'when', 'send', 'we', 'us']filtered = [i for i in a if not i[0] in b]>>>print(filtered)[('why', 4), ('throw', 9), ('you', 1)]