Is there a better way to do this in python, or rather: is this a good way to do this?
x = ('a', 'b', 'c')
y = ('d', 'e', 'f')
z = ('g', 'e', 'i')
l = [x, y, z]
s = set([e for (_, e, _) in l])
I look a little ugly, but I do what I need without writing the complicated function get_unique_elements_from_tuple_list ...;)
edit: expected value of s set (['b', 'e'])
source
share