⬅︎ Back to Fastest way to uniqify a list in Python
>>>li=['a', 'mpilgrim', 'foo', 'b', 'c', 'b', 'd', 'd']>>>[x for x in li if x not in locals()['_[1]']]output:['a', 'mpilgrim', 'foo', 'b', 'c', 'd']While, I can't explain how locals()['_[1]'] works....
I could explain it, but then I'd have to kill you...
Comment
>>>li=['a', 'mpilgrim', 'foo', 'b', 'c', 'b', 'd', 'd']
>>>[x for x in li if x not in locals()['_[1]']]
output:
['a', 'mpilgrim', 'foo', 'b', 'c', 'd']
While, I can't explain how locals()['_[1]'] works....
Replies
I could explain it, but then I'd have to kill you...