I have a python list where elements can repeat.
>>> a = [1,2,2,3,3,4,5,6]
I want to get the first n unique elements from
n
Why not use something like this?
>>> a = [1, 2, 2, 3, 3, 4, 5, 6] >>> list(set(a))[:5] [1, 2, 3, 4, 5]