I'd like to loop over a list of tuples but having one of the indexes fixed with a determined value, like say we have this list:
myList = [(1,2,3) , (1,2,2), (2,3,4), (3,4,5), (1,3,4), (4,5,6), (4,6,8)]
and i wanted to loop over it fixing my first index with the value 1, so in the loop I would be accessing those, and only those, values:
[(1,2,3), (1,2,2), (1,3,4)]
I know I can do this:
newList = []
for item in myList:
if item[0] == 1:
newList.append(item)
and then loop over this new list, but is there a direct or more perfomatic way of doing this?!