I am trying to check a list of tuples for certain types of tuples. I thought the _ operator would work here, but it doesn't work. I guess I could iterate through the list and check by hand, but I feel there is a pythonic way of solving this. Afterwards, I would like to remove all tuples that have a (1, ) in the first position. A filter would be my try for the removal process.
self.bids = [(1,1),(1,2),(1,3),(2,0),(3,1),(3,2)]
if (1,_) in bids or (2,_) in bids or (3,_) in bids:
possibleModes.remove((1,_))
return possibleModes
Aucun commentaire:
Enregistrer un commentaire