Get unique values in List of Lists in python -
i want create list (or set) of unique values appearing in list of lists in python. have this:
alist=[['a','b'], ['a', 'b','c'], ['a']]
and following:
unique_values=['a','b','c']
i know list of strings can use set(alist), can't figure how solve in list of lists, since set(alist) gets me error message
unhashable type: 'list'
how can solve it?
array = [['a','b'], ['a', 'b','c'], ['a']] result = set(x l in array x in l)
Comments
Post a Comment