I have a list of tuples with each tuple containing two values. The first value is a list of strings, the second value is a string:
list_of_tuples = [(['this', 'askjsdaddsa', 'match1'], 'done'), (['sajs', 'skasassas', 'asdasdasdasd', 'qwerty'], 'doneagain')]
How can I reduce the first value within the tuple to only the strings that contain six letters? Ideally I would have
final_list_of_tuples = [('match1' , 'done'), ('qwerty', 'doneagain')]
So far I have the following:
for a, b in dict_refine:
a.remove(i for i in a if len(i) != 6)
I feel as if there is something very elementary that I am blowing right past. Is there a way to do this in one line? Would it be easier to output into a dictionary?