The thing you showed isn't actually a list, and it's hard to guess what the actual list might be. But I'm going to assume it's something like this:
list_o_lists = [428,
[(' whether', None), (' mated', None), (' rooster', None), ('', None)],
429,
[(' produced', None),
(' without', None),
(' rooster', None),
(' infertile', None),
('', None)]]
Any list comprehension to access the tuples within that is already going to be pretty horrible:
[[tup for tup in lst] if is_sequence(lst) else lst for lst in list_o_lists]
But modifying it to access the second element of each tuple is trivial:
[[tup[1] for tup in lst] if is_sequence(lst) else lst for lst in list_o_lists]
Really, no matter what your list comprehension is, no matter how horrible it is, based on your question, somewhere you've got each tuple as an expression, which means all you have to do is put a [1]
on that expression.
From your comment:
Sorry, the numbers are the index values.
I think you actually have something simpler:
list_o_lists = [
[(' whether', None), (' mated', None), (' rooster', None), ('', None)],
[(' produced', None),
(' without', None),
(' rooster', None),
(' infertile', None),
('', None)]]
And then your attempted list comprehension was probably something like this:
[[tup for tup in lst] for lst in list_o_lists]
Of course this is just a guess, because you still haven't shown us your actual list, or the list comprehension you tried. But as I said above: "… no matter what your list comprehension is… somewhere you've got each tuple as an expression, which means all you have to do is put a [1]
on that expression."
So, this one is just as easy to change as the one above:
[[tup[1] for tup in lst] for lst in list_o_lists]
And if it's not what you actually have, then what you actually have will also be just as easy to change. But you'll have to do it yourself, because we have all failed in our repeated attempts to read your mind, while you have your actual code in front of you.