python - Searching for a partial match in a list of tuples -
if have list of tuples:
[(0,1),(1,2),(5,5),(4,1)]
how can find items partially match search term?
eg, in above example, (_, 1)
should match (0, 1)
, (4, 1)
.
new_list = [i in old_list if i[1] == 1]
Comments
Post a Comment