我有一个元组列表
mylist = [(100, 'Unknown'), ('Unknown Player', 'BBB'), (20, 90), (40, 'DDD')]
我想返回包含该单词的元组列表Unknown
我试过:
matches = [x for x in mylist if 'Unknown' in x]
但这会返回:(100,'Unknown)
我想返回:[(100, 'Unknown'), ('Unknown Player', 'BBB')]
aluckdog
繁星点点滴滴
相关分类